@kitsy/cnos 1.6.1 → 1.8.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 (63) hide show
  1. package/dist/build/index.cjs +1332 -156
  2. package/dist/build/index.d.cts +1 -1
  3. package/dist/build/index.d.ts +1 -1
  4. package/dist/build/index.js +36 -14
  5. package/dist/{chunk-JYWQFMW5.js → chunk-2DGT7N7E.js} +1 -1
  6. package/dist/{chunk-S7H2UULC.js → chunk-2TL42I6M.js} +1323 -139
  7. package/dist/{chunk-MW4OVAT3.js → chunk-5KIQCYFH.js} +1 -1
  8. package/dist/{chunk-6FAX2VKQ.js → chunk-CW7SNVIQ.js} +195 -28
  9. package/dist/{chunk-XSUP7JKH.js → chunk-GHGJFRDL.js} +6 -2
  10. package/dist/{chunk-BMAD24KC.js → chunk-OA7FQGAG.js} +1 -1
  11. package/dist/{chunk-VGZREX5D.js → chunk-RYIARE4M.js} +1 -1
  12. package/dist/{chunk-UR7CHHNN.js → chunk-TT4NV56Z.js} +3 -2
  13. package/dist/{chunk-UJBQS7CJ.js → chunk-UL63DFLS.js} +1 -1
  14. package/dist/{chunk-N32UN66E.js → chunk-ZD4YX6VC.js} +8 -8
  15. package/dist/configure/index.cjs +1309 -155
  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/{plugin-CKrBlWGI.d.cts → core-BJ8xewez.d.cts} +142 -60
  20. package/dist/{plugin-CKrBlWGI.d.ts → core-BJ8xewez.d.ts} +142 -60
  21. package/dist/{envNaming-B7Mztkcf.d.ts → envNaming-BRyiuPoI.d.ts} +1 -1
  22. package/dist/{envNaming-gMVnPOfe.d.cts → envNaming-rx71gpi0.d.cts} +1 -1
  23. package/dist/index.cjs +1548 -227
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +10 -10
  27. package/dist/internal.cjs +831 -122
  28. package/dist/internal.d.cts +56 -3
  29. package/dist/internal.d.ts +56 -3
  30. package/dist/internal.js +30 -3
  31. package/dist/plugin/basic-schema.cjs +49 -23
  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 +38 -23
  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 +46 -31
  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 +56 -27
  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 +61 -39
  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 +40 -25
  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 +1548 -227
  56. package/dist/runtime/index.d.cts +3 -1
  57. package/dist/runtime/index.d.ts +3 -1
  58. package/dist/runtime/index.js +10 -10
  59. package/dist/toPublicEnv-CCSgdvI9.d.ts +13 -0
  60. package/dist/toPublicEnv-ivRtLjcw.d.cts +13 -0
  61. package/package.json +1 -1
  62. package/dist/toPublicEnv-CmBsy53P.d.cts +0 -7
  63. package/dist/toPublicEnv-q6VwWxXZ.d.ts +0 -7
@@ -1,4 +1,4 @@
1
- import { C as CnosCreateOptions, S as ServerProjection } from '../plugin-CKrBlWGI.cjs';
1
+ import { C as CnosCreateOptions, S as ServerProjection } from '../core-BJ8xewez.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 '../plugin-CKrBlWGI.js';
1
+ import { C as CnosCreateOptions, S as ServerProjection } from '../core-BJ8xewez.js';
2
2
 
3
3
  type BrowserDataMap = Record<string, unknown>;
4
4
  type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
@@ -1,23 +1,36 @@
1
1
  import {
2
2
  createCnos
3
- } from "../chunk-N32UN66E.js";
4
- import "../chunk-VGZREX5D.js";
5
- import "../chunk-UR7CHHNN.js";
6
- import "../chunk-UJBQS7CJ.js";
7
- import "../chunk-MW4OVAT3.js";
8
- import "../chunk-JYWQFMW5.js";
9
- import "../chunk-BMAD24KC.js";
10
- import "../chunk-S7H2UULC.js";
3
+ } from "../chunk-ZD4YX6VC.js";
4
+ import "../chunk-RYIARE4M.js";
5
+ import "../chunk-TT4NV56Z.js";
6
+ import "../chunk-UL63DFLS.js";
7
+ import "../chunk-5KIQCYFH.js";
8
+ import "../chunk-2DGT7N7E.js";
9
+ import "../chunk-OA7FQGAG.js";
10
+ import "../chunk-2TL42I6M.js";
11
11
 
12
12
  // src/build/index.ts
13
13
  async function resolveBrowserData(options = {}) {
14
- const runtime = await createCnos(options);
14
+ const runtime = await createCnos({
15
+ ...options,
16
+ cacheMode: options.cacheMode ?? "build"
17
+ });
15
18
  const browserData = {};
16
- for (const [key, entry] of runtime.graph.entries) {
19
+ for (const [key] of runtime.graph.entries) {
17
20
  if (!key.startsWith("public.")) {
18
21
  continue;
19
22
  }
20
- browserData[key] = entry.value;
23
+ const inspect = runtime.inspect(key);
24
+ if (inspect.derived?.runtimeDependent) {
25
+ throw new Error(
26
+ `Cannot build browser projection: ${key} depends on runtime namespaces ${inspect.derived.runtimeNamespaces.join(", ") || "runtime"}.`
27
+ );
28
+ }
29
+ const value = runtime.read(key);
30
+ if (value === void 0) {
31
+ continue;
32
+ }
33
+ browserData[key] = value;
21
34
  }
22
35
  return browserData;
23
36
  }
@@ -57,17 +70,26 @@ function toFrameworkEnv(browserData, framework = "generic", options = {}) {
57
70
  }
58
71
  async function resolveFrameworkEnv(options = {}, framework = "generic", envOptions = {}) {
59
72
  if (framework === "generic") {
60
- const browserData = await resolveBrowserData(options);
73
+ const browserData = await resolveBrowserData({
74
+ ...options,
75
+ cacheMode: options.cacheMode ?? "build"
76
+ });
61
77
  return toFrameworkEnv(browserData, framework, envOptions);
62
78
  }
63
- const runtime = await createCnos(options);
79
+ const runtime = await createCnos({
80
+ ...options,
81
+ cacheMode: options.cacheMode ?? "build"
82
+ });
64
83
  return runtime.toPublicEnv({
65
84
  framework,
66
85
  ...envOptions.prefix ? { prefix: envOptions.prefix } : {}
67
86
  });
68
87
  }
69
88
  async function resolveServerProjection(options = {}) {
70
- const runtime = await createCnos(options);
89
+ const runtime = await createCnos({
90
+ ...options,
91
+ cacheMode: options.cacheMode ?? "build"
92
+ });
71
93
  return runtime.toServerProjection();
72
94
  }
73
95
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  joinConfigPath
3
- } from "./chunk-S7H2UULC.js";
3
+ } from "./chunk-2TL42I6M.js";
4
4
 
5
5
  // ../../plugins/cli-args/src/index.ts
6
6
  var CLI_ARGS_PLUGIN_ID = "@kitsy/cnos/plugins/cli-args";