@kitsy/cnos 1.9.2 → 1.11.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.
Files changed (61) hide show
  1. package/dist/build/index.cjs +523 -80
  2. package/dist/build/index.d.cts +1 -1
  3. package/dist/build/index.d.ts +1 -1
  4. package/dist/build/index.js +13 -15
  5. package/dist/{chunk-6QQPHDUI.js → chunk-2DMCB3PK.js} +1 -1
  6. package/dist/{chunk-LURQ4LAK.js → chunk-5JGNRADB.js} +1 -1
  7. package/dist/{chunk-2JBA2LXU.js → chunk-DPC2BV3S.js} +35 -6
  8. package/dist/{chunk-7JZO6XN3.js → chunk-KJ57PF47.js} +1 -1
  9. package/dist/{chunk-CPGRRZLP.js → chunk-NFGPS7VJ.js} +8 -8
  10. package/dist/{chunk-A2WG3ZKW.js → chunk-NU25VFA2.js} +1 -1
  11. package/dist/{chunk-L7JVECPE.js → chunk-RNTTPI5S.js} +1 -1
  12. package/dist/{chunk-NVFACB64.js → chunk-T3E57MSQ.js} +1 -1
  13. package/dist/{chunk-7KVM5PUW.js → chunk-WPB4HB2K.js} +478 -61
  14. package/dist/{chunk-QK7BMU47.js → chunk-XGK6DXQL.js} +157 -37
  15. package/dist/configure/index.cjs +521 -76
  16. package/dist/configure/index.d.cts +3 -3
  17. package/dist/configure/index.d.ts +3 -3
  18. package/dist/configure/index.js +8 -8
  19. package/dist/{core-zDTUSVx9.d.cts → core-BW8SLnRx.d.cts} +46 -7
  20. package/dist/{core-zDTUSVx9.d.ts → core-BW8SLnRx.d.ts} +46 -7
  21. package/dist/{envNaming-EFzezmB3.d.cts → envNaming-1rk7BR0e.d.cts} +1 -1
  22. package/dist/{envNaming-BkorOKW_.d.ts → envNaming-CjL28IeH.d.ts} +1 -1
  23. package/dist/index.cjs +672 -108
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +10 -10
  27. package/dist/internal.cjs +378 -54
  28. package/dist/internal.d.cts +32 -4
  29. package/dist/internal.d.ts +32 -4
  30. package/dist/internal.js +141 -23
  31. package/dist/plugin/basic-schema.cjs +13 -3
  32. package/dist/plugin/basic-schema.d.cts +1 -1
  33. package/dist/plugin/basic-schema.d.ts +1 -1
  34. package/dist/plugin/basic-schema.js +2 -2
  35. package/dist/plugin/cli-args.cjs +4 -1
  36. package/dist/plugin/cli-args.d.cts +1 -1
  37. package/dist/plugin/cli-args.d.ts +1 -1
  38. package/dist/plugin/cli-args.js +2 -2
  39. package/dist/plugin/dotenv.cjs +40 -8
  40. package/dist/plugin/dotenv.d.cts +2 -2
  41. package/dist/plugin/dotenv.d.ts +2 -2
  42. package/dist/plugin/dotenv.js +2 -2
  43. package/dist/plugin/env-export.cjs +5 -2
  44. package/dist/plugin/env-export.d.cts +2 -2
  45. package/dist/plugin/env-export.d.ts +2 -2
  46. package/dist/plugin/env-export.js +2 -2
  47. package/dist/plugin/filesystem.cjs +13 -10
  48. package/dist/plugin/filesystem.d.cts +1 -1
  49. package/dist/plugin/filesystem.d.ts +1 -1
  50. package/dist/plugin/filesystem.js +2 -2
  51. package/dist/plugin/process-env.cjs +4 -1
  52. package/dist/plugin/process-env.d.cts +2 -2
  53. package/dist/plugin/process-env.d.ts +2 -2
  54. package/dist/plugin/process-env.js +2 -2
  55. package/dist/runtime/index.cjs +672 -108
  56. package/dist/runtime/index.d.cts +13 -6
  57. package/dist/runtime/index.d.ts +13 -6
  58. package/dist/runtime/index.js +10 -10
  59. package/dist/{toPublicEnv-Ds1DRwCX.d.cts → toPublicEnv-CZzpvhGg.d.cts} +1 -1
  60. package/dist/{toPublicEnv-CT265rzS.d.ts → toPublicEnv-CmydGcxg.d.ts} +1 -1
  61. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { C as CnosCreateOptions, S as ServerProjection } from '../core-zDTUSVx9.cjs';
1
+ import { C as CnosCreateOptions, S as ServerProjection } from '../core-BW8SLnRx.cjs';
2
2
 
3
3
  type BrowserDataMap = Record<string, unknown>;
4
4
  type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
@@ -1,4 +1,4 @@
1
- import { C as CnosCreateOptions, S as ServerProjection } from '../core-zDTUSVx9.js';
1
+ import { C as CnosCreateOptions, S as ServerProjection } from '../core-BW8SLnRx.js';
2
2
 
3
3
  type BrowserDataMap = Record<string, unknown>;
4
4
  type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createCnos
3
- } from "../chunk-CPGRRZLP.js";
4
- import "../chunk-LURQ4LAK.js";
5
- import "../chunk-A2WG3ZKW.js";
6
- import "../chunk-L7JVECPE.js";
7
- import "../chunk-6QQPHDUI.js";
8
- import "../chunk-7JZO6XN3.js";
9
- import "../chunk-2JBA2LXU.js";
3
+ } from "../chunk-NFGPS7VJ.js";
4
+ import "../chunk-5JGNRADB.js";
5
+ import "../chunk-NU25VFA2.js";
6
+ import "../chunk-RNTTPI5S.js";
7
+ import "../chunk-2DMCB3PK.js";
8
+ import "../chunk-KJ57PF47.js";
9
+ import "../chunk-DPC2BV3S.js";
10
10
  import {
11
11
  CnosManifestError,
12
- createSecretVaultProvider,
12
+ assertSecretRefVaultProviderCompatible,
13
13
  isSecretReference
14
- } from "../chunk-7KVM5PUW.js";
14
+ } from "../chunk-WPB4HB2K.js";
15
15
 
16
16
  // src/build/index.ts
17
17
  async function resolveBrowserData(options = {}) {
@@ -106,15 +106,13 @@ function validateServerProjectionSecretRefs(runtime) {
106
106
  }
107
107
  const vaultId = entry.value.vault ?? "default";
108
108
  const definition = runtime.manifest.vaults[vaultId];
109
- if (!definition) {
109
+ if (!definition && entry.value.vault) {
110
110
  throw new CnosManifestError(`Unknown vault "${vaultId}" for secret ref "${entry.key}"`);
111
111
  }
112
- if (entry.value.provider !== definition.provider) {
113
- throw new CnosManifestError(
114
- `Secret ref "${entry.key}" declares provider "${entry.value.provider}" but vault "${vaultId}" uses provider "${definition.provider}"`
115
- );
112
+ if (!definition && !entry.value.provider) {
113
+ throw new CnosManifestError(`Secret ref "${entry.key}" must declare a provider or reference a configured vault`);
116
114
  }
117
- createSecretVaultProvider(vaultId, definition);
115
+ assertSecretRefVaultProviderCompatible(runtime.manifest, entry.value, entry.key);
118
116
  }
119
117
  }
120
118
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  applySchemaRules
3
- } from "./chunk-7KVM5PUW.js";
3
+ } from "./chunk-WPB4HB2K.js";
4
4
 
5
5
  // ../../plugins/basic-schema/src/index.ts
6
6
  function createBasicSchemaPlugin() {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toEnv,
3
3
  toPublicEnv
4
- } from "./chunk-7KVM5PUW.js";
4
+ } from "./chunk-WPB4HB2K.js";
5
5
 
6
6
  // ../../plugins/env-export/src/index.ts
7
7
  function createEnvExportPlugin() {
@@ -2,7 +2,7 @@ import {
2
2
  envVarToLogicalKey,
3
3
  resolveWorkspaceScopedPath,
4
4
  toPortablePath
5
- } from "./chunk-7KVM5PUW.js";
5
+ } from "./chunk-WPB4HB2K.js";
6
6
 
7
7
  // ../../plugins/dotenv/src/index.ts
8
8
  import { readFile } from "fs/promises";
@@ -11,9 +11,30 @@ var DOTENV_PLUGIN_ID = "@kitsy/cnos/plugins/dotenv";
11
11
  function parseDoubleQuoted(value) {
12
12
  return value.replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
13
13
  }
14
+ function isEscapedCharacter(value, index) {
15
+ let slashCount = 0;
16
+ for (let cursor = index - 1; cursor >= 0 && value[cursor] === "\\"; cursor -= 1) {
17
+ slashCount += 1;
18
+ }
19
+ return slashCount % 2 === 1;
20
+ }
21
+ function findClosingQuote(value, quote) {
22
+ for (let index = 0; index < value.length; index += 1) {
23
+ if (value[index] !== quote) {
24
+ continue;
25
+ }
26
+ if (quote === '"' && isEscapedCharacter(value, index)) {
27
+ continue;
28
+ }
29
+ return index;
30
+ }
31
+ return -1;
32
+ }
14
33
  function parseDotenv(document) {
15
34
  const parsed = {};
16
- for (const rawLine of document.split(/\r?\n/)) {
35
+ const lines = document.split(/\r?\n/);
36
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
37
+ const rawLine = lines[lineIndex] ?? "";
17
38
  const line = rawLine.trim();
18
39
  if (!line || line.startsWith("#")) {
19
40
  continue;
@@ -28,10 +49,18 @@ function parseDotenv(document) {
28
49
  if (!envVar) {
29
50
  continue;
30
51
  }
31
- if (value.startsWith('"') && value.endsWith('"')) {
32
- value = parseDoubleQuoted(value.slice(1, -1));
33
- } else if (value.startsWith("'") && value.endsWith("'")) {
34
- value = value.slice(1, -1);
52
+ if (value.startsWith('"') || value.startsWith("'")) {
53
+ const quote = value.startsWith('"') ? '"' : "'";
54
+ let quotedContent = value.slice(1);
55
+ let closingIndex = findClosingQuote(quotedContent, quote);
56
+ while (closingIndex === -1 && lineIndex < lines.length - 1) {
57
+ lineIndex += 1;
58
+ quotedContent = `${quotedContent}
59
+ ${lines[lineIndex] ?? ""}`;
60
+ closingIndex = findClosingQuote(quotedContent, quote);
61
+ }
62
+ const rawQuotedValue = closingIndex === -1 ? quotedContent : quotedContent.slice(0, closingIndex);
63
+ value = quote === '"' ? parseDoubleQuoted(rawQuotedValue) : rawQuotedValue;
35
64
  } else {
36
65
  value = value.replace(/\s+#.*$/, "").trim();
37
66
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  joinConfigPath
3
- } from "./chunk-7KVM5PUW.js";
3
+ } from "./chunk-WPB4HB2K.js";
4
4
 
5
5
  // ../../plugins/cli-args/src/index.ts
6
6
  var CLI_ARGS_PLUGIN_ID = "@kitsy/cnos/plugins/cli-args";
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  createEnvExportPlugin,
3
3
  createPublicEnvExportPlugin
4
- } from "./chunk-LURQ4LAK.js";
4
+ } from "./chunk-5JGNRADB.js";
5
5
  import {
6
6
  createFilesystemSecretsPlugin,
7
7
  createFilesystemValuesPlugin
8
- } from "./chunk-A2WG3ZKW.js";
8
+ } from "./chunk-NU25VFA2.js";
9
9
  import {
10
10
  createProcessEnvPlugin
11
- } from "./chunk-L7JVECPE.js";
11
+ } from "./chunk-RNTTPI5S.js";
12
12
  import {
13
13
  createBasicSchemaPlugin
14
- } from "./chunk-6QQPHDUI.js";
14
+ } from "./chunk-2DMCB3PK.js";
15
15
  import {
16
16
  createCliArgsPlugin
17
- } from "./chunk-7JZO6XN3.js";
17
+ } from "./chunk-KJ57PF47.js";
18
18
  import {
19
19
  createDotenvPlugin
20
- } from "./chunk-2JBA2LXU.js";
20
+ } from "./chunk-DPC2BV3S.js";
21
21
  import {
22
22
  createCnos,
23
23
  createProvenanceInspector
24
- } from "./chunk-7KVM5PUW.js";
24
+ } from "./chunk-WPB4HB2K.js";
25
25
 
26
26
  // src/defaultPlugins.ts
27
27
  function defaultPlugins() {
@@ -68,7 +68,7 @@ function setBootstrappedSecretHydrationRequired(value) {
68
68
  // package.json
69
69
  var package_default = {
70
70
  name: "@kitsy/cnos",
71
- version: "1.9.2",
71
+ version: "1.11.0",
72
72
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
73
73
  type: "module",
74
74
  main: "./dist/index.cjs",
@@ -4,7 +4,7 @@ import {
4
4
  isSecretReference,
5
5
  parseYaml,
6
6
  toPortablePath
7
- } from "./chunk-7KVM5PUW.js";
7
+ } from "./chunk-WPB4HB2K.js";
8
8
 
9
9
  // ../../plugins/filesystem/src/helpers.ts
10
10
  import { readdir } from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  envVarToLogicalKey
3
- } from "./chunk-7KVM5PUW.js";
3
+ } from "./chunk-WPB4HB2K.js";
4
4
 
5
5
  // ../../plugins/process-env/src/index.ts
6
6
  var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSecretReference
3
- } from "./chunk-7KVM5PUW.js";
3
+ } from "./chunk-WPB4HB2K.js";
4
4
 
5
5
  // src/runtime/bootstrap.ts
6
6
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";