@powerlines/plugin-date 0.12.260 → 0.12.261

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 (184) hide show
  1. package/dist/components/date-fns.cjs +3 -2
  2. package/dist/components/date-fns.mjs +1 -1
  3. package/dist/components/dayjs.cjs +3 -2
  4. package/dist/components/dayjs.mjs +1 -1
  5. package/dist/components/luxon.cjs +3 -2
  6. package/dist/components/luxon.mjs +1 -1
  7. package/dist/components/moment.cjs +3 -2
  8. package/dist/components/moment.mjs +1 -1
  9. package/dist/index.cjs +3 -2
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/types/plugin.d.cts +1 -1
  14. package/dist/types/plugin.d.mts +1 -1
  15. package/package.json +4 -4
  16. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  17. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  18. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  19. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  20. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  21. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  22. package/dist/deepkit/src/capnp.cjs +0 -913
  23. package/dist/deepkit/src/capnp.mjs +0 -911
  24. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  25. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  26. package/dist/deepkit/src/reflect-type.cjs +0 -22
  27. package/dist/deepkit/src/reflect-type.mjs +0 -20
  28. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  29. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  30. package/dist/deepkit/src/transformer.cjs +0 -52
  31. package/dist/deepkit/src/transformer.mjs +0 -49
  32. package/dist/deepkit/src/transpile.cjs +0 -29
  33. package/dist/deepkit/src/transpile.mjs +0 -27
  34. package/dist/deepkit/src/types.d.cts +0 -10
  35. package/dist/deepkit/src/types.d.mts +0 -10
  36. package/dist/deepkit/src/utilities.cjs +0 -67
  37. package/dist/deepkit/src/utilities.mjs +0 -66
  38. package/dist/plugin-alloy/src/core/components/output.cjs +0 -36
  39. package/dist/plugin-alloy/src/core/components/output.mjs +0 -35
  40. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  41. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  42. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -38
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -34
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  52. package/dist/plugin-alloy/src/index.cjs +0 -102
  53. package/dist/plugin-alloy/src/index.mjs +0 -100
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -89
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -88
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -33
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -32
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  60. package/dist/plugin-alloy/src/types/components.d.mts +0 -3
  61. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  62. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  63. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  64. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -52
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -51
  66. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -78
  67. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -76
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -364
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -355
  70. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -157
  71. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -154
  72. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -57
  73. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -56
  74. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  75. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  76. package/dist/plugin-automd/src/index.cjs +0 -101
  77. package/dist/plugin-automd/src/index.mjs +0 -98
  78. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  79. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  80. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  81. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  82. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  83. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  84. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  85. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  86. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  87. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  88. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  89. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  90. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  91. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  92. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  93. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  94. package/dist/plugin-babel/src/index.cjs +0 -85
  95. package/dist/plugin-babel/src/index.mjs +0 -83
  96. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  97. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  98. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  99. package/dist/plugin-env/src/babel/index.cjs +0 -1
  100. package/dist/plugin-env/src/babel/index.mjs +0 -3
  101. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  102. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  103. package/dist/plugin-env/src/components/docs.cjs +0 -60
  104. package/dist/plugin-env/src/components/docs.mjs +0 -59
  105. package/dist/plugin-env/src/components/env.cjs +0 -497
  106. package/dist/plugin-env/src/components/env.mjs +0 -494
  107. package/dist/plugin-env/src/components/index.cjs +0 -2
  108. package/dist/plugin-env/src/components/index.mjs +0 -4
  109. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  110. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  111. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  112. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  113. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  114. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  115. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  116. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  117. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  118. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  119. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  120. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  121. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  122. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  123. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  124. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  125. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  126. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  127. package/dist/plugin-env/src/index.cjs +0 -174
  128. package/dist/plugin-env/src/index.mjs +0 -172
  129. package/dist/plugin-env/src/types/plugin.d.cts +0 -148
  130. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  131. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  132. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  133. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  134. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  135. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  136. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  137. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  138. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  139. package/dist/powerlines/src/lib/entry.cjs +0 -11
  140. package/dist/powerlines/src/lib/entry.mjs +0 -13
  141. package/dist/powerlines/src/lib/logger.cjs +0 -41
  142. package/dist/powerlines/src/lib/logger.mjs +0 -39
  143. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  144. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  145. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  146. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  147. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  148. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  149. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  150. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  151. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  152. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  153. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  154. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  155. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  156. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  157. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  158. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  159. package/dist/powerlines/src/types/api.d.cts +0 -104
  160. package/dist/powerlines/src/types/api.d.mts +0 -104
  161. package/dist/powerlines/src/types/babel.d.cts +0 -22
  162. package/dist/powerlines/src/types/babel.d.mts +0 -22
  163. package/dist/powerlines/src/types/build.cjs +0 -21
  164. package/dist/powerlines/src/types/build.d.cts +0 -185
  165. package/dist/powerlines/src/types/build.d.mts +0 -185
  166. package/dist/powerlines/src/types/build.mjs +0 -21
  167. package/dist/powerlines/src/types/commands.d.cts +0 -8
  168. package/dist/powerlines/src/types/commands.d.mts +0 -9
  169. package/dist/powerlines/src/types/config.d.cts +0 -435
  170. package/dist/powerlines/src/types/config.d.mts +0 -436
  171. package/dist/powerlines/src/types/context.d.cts +0 -514
  172. package/dist/powerlines/src/types/context.d.mts +0 -514
  173. package/dist/powerlines/src/types/fs.d.cts +0 -486
  174. package/dist/powerlines/src/types/fs.d.mts +0 -486
  175. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  176. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  177. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  178. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  179. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  180. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  181. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  182. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  183. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  184. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,15 +0,0 @@
1
- import { joinPaths } from "@stryke/path/join";
2
-
3
- //#region ../plugin-env/src/helpers/docs-helper.ts
4
- /**
5
- * Gets the output path for the generated environment documentation.
6
- *
7
- * @param context - The environment plugin context.
8
- * @returns The output path for the generated environment documentation.
9
- */
10
- function getDocsOutputPath(context) {
11
- return joinPaths(context.config.projectRoot, "docs", "generated");
12
- }
13
-
14
- //#endregion
15
- export { getDocsOutputPath };
@@ -1,6 +0,0 @@
1
- const require_source_file_env = require('./source-file-env.cjs');
2
- const require_load = require('./load.cjs');
3
- const require_reflect = require('./reflect.cjs');
4
- const require_persistence = require('./persistence.cjs');
5
- const require_create_reflection_resource = require('./create-reflection-resource.cjs');
6
- require('./template-helpers.cjs');
@@ -1,8 +0,0 @@
1
- import { removeEnvPrefix } from "./source-file-env.mjs";
2
- import { loadEnv, loadEnvFromContext } from "./load.mjs";
3
- import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
4
- import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvTypeReflection } from "./persistence.mjs";
5
- import { createReflectionResource } from "./create-reflection-resource.mjs";
6
- import "./template-helpers.mjs";
7
-
8
- export { };
@@ -1,84 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_environments = require('../../../powerlines/src/lib/constants/environments.cjs');
3
- const require_source_file_env = require('./source-file-env.cjs');
4
- let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
- let defu = require("defu");
6
- defu = require_rolldown_runtime.__toESM(defu);
7
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
8
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
9
- let c12 = require("c12");
10
- let __stryke_env_load_env = require("@stryke/env/load-env");
11
-
12
- //#region ../plugin-env/src/helpers/load.ts
13
- async function loadEnvFiles(options, mode, cwd) {
14
- let env = await (0, __stryke_env_load_env.loadEnv)(cwd, mode);
15
- if (options.additionalFiles && options.additionalFiles?.length > 0) {
16
- const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => (0, __stryke_env_load_env.loadEnvFile)(additionalEnvFile, cwd)));
17
- for (const additionalEnvFile of additionalEnvFiles) env = (0, defu.default)(additionalEnvFile, env);
18
- }
19
- return require_source_file_env.removeEnvPrefix(env);
20
- }
21
- async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson, workspaceConfig) {
22
- const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), (0, c12.loadConfig)({
23
- cwd: directory,
24
- name: "storm",
25
- envName: mode,
26
- defaults: {
27
- NAME: packageJson.name?.replace(`@${workspaceConfig.namespace}/`, ""),
28
- MODE: mode,
29
- ORG: workspaceConfig.organization
30
- },
31
- globalRc: true,
32
- packageJson: true,
33
- dotenv: true,
34
- jitiOptions: {
35
- fsCache: (0, __stryke_path_join_paths.joinPaths)(cacheDir, "jiti"),
36
- moduleCache: true
37
- }
38
- })]);
39
- return (0, defu.default)(envResult, c12Result.config, workspaceConfig);
40
- }
41
- /**
42
- * Retrieves various dotenv configuration parameters from the context.
43
- *
44
- * @param context - The context to retrieve the dotenv configuration from.
45
- * @param parsed - The parsed dotenv configuration.
46
- * @returns An object containing the dotenv configuration.
47
- */
48
- function loadEnvFromContext(context, parsed) {
49
- return (0, defu.default)({
50
- APP_NAME: (0, __stryke_string_format_kebab_case.kebabCase)(context.config.name || context.packageJson.name?.replace(`/${context.workspaceConfig.namespace}`, "")),
51
- APP_VERSION: context.packageJson.version,
52
- BUILD_ID: context.meta.buildId,
53
- BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),
54
- BUILD_CHECKSUM: context.meta.checksum,
55
- RELEASE_ID: context.meta.releaseId,
56
- RELEASE_TAG: `${(0, __stryke_string_format_kebab_case.kebabCase)(context.config.name)}@${context.packageJson.version}`,
57
- DEFAULT_LOCALE: context.workspaceConfig.locale,
58
- DEFAULT_TIMEZONE: context.workspaceConfig.timezone,
59
- LOG_LEVEL: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
60
- ERROR_URL: context.workspaceConfig.error?.url,
61
- ORGANIZATION: context.config.organization || ((0, __stryke_type_checks_is_set_object.isSetObject)(context.workspaceConfig.organization) ? context.workspaceConfig.organization.name : context.workspaceConfig.organization),
62
- PLATFORM: context.config.build.platform,
63
- MODE: context.config.mode,
64
- TEST: context.config.mode === "test",
65
- DEBUG: context.config.mode === "development",
66
- STACKTRACE: context.config.mode !== "production",
67
- ENVIRONMENT: !context.environment.name || context.environment.name === require_environments.DEFAULT_ENVIRONMENT ? context.config.mode : context.environment.name
68
- }, (0, __stryke_type_checks_is_set_object.isSetObject)(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce((ret, prop) => {
69
- ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();
70
- return ret;
71
- }, {}) : {});
72
- }
73
- async function loadEnv(context, options) {
74
- const [project, workspace, config] = await Promise.all([
75
- loadEnvDirectory(options, context.config.projectRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
76
- loadEnvDirectory(options, context.workspaceConfig.workspaceRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
77
- loadEnvDirectory(options, context.envPaths.config, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)
78
- ]);
79
- return (0, defu.default)(loadEnvFromContext(context, process.env), project, workspace, config);
80
- }
81
-
82
- //#endregion
83
- exports.loadEnv = loadEnv;
84
- exports.loadEnvFromContext = loadEnvFromContext;
@@ -1,81 +0,0 @@
1
- import { DEFAULT_ENVIRONMENT } from "../../../powerlines/src/lib/constants/environments.mjs";
2
- import { removeEnvPrefix } from "./source-file-env.mjs";
3
- import { isSetObject } from "@stryke/type-checks/is-set-object";
4
- import defu from "defu";
5
- import { kebabCase } from "@stryke/string-format/kebab-case";
6
- import { joinPaths } from "@stryke/path/join-paths";
7
- import { loadConfig } from "c12";
8
- import { loadEnv, loadEnvFile } from "@stryke/env/load-env";
9
-
10
- //#region ../plugin-env/src/helpers/load.ts
11
- async function loadEnvFiles(options, mode, cwd) {
12
- let env = await loadEnv(cwd, mode);
13
- if (options.additionalFiles && options.additionalFiles?.length > 0) {
14
- const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => loadEnvFile(additionalEnvFile, cwd)));
15
- for (const additionalEnvFile of additionalEnvFiles) env = defu(additionalEnvFile, env);
16
- }
17
- return removeEnvPrefix(env);
18
- }
19
- async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson, workspaceConfig) {
20
- const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), loadConfig({
21
- cwd: directory,
22
- name: "storm",
23
- envName: mode,
24
- defaults: {
25
- NAME: packageJson.name?.replace(`@${workspaceConfig.namespace}/`, ""),
26
- MODE: mode,
27
- ORG: workspaceConfig.organization
28
- },
29
- globalRc: true,
30
- packageJson: true,
31
- dotenv: true,
32
- jitiOptions: {
33
- fsCache: joinPaths(cacheDir, "jiti"),
34
- moduleCache: true
35
- }
36
- })]);
37
- return defu(envResult, c12Result.config, workspaceConfig);
38
- }
39
- /**
40
- * Retrieves various dotenv configuration parameters from the context.
41
- *
42
- * @param context - The context to retrieve the dotenv configuration from.
43
- * @param parsed - The parsed dotenv configuration.
44
- * @returns An object containing the dotenv configuration.
45
- */
46
- function loadEnvFromContext(context, parsed) {
47
- return defu({
48
- APP_NAME: kebabCase(context.config.name || context.packageJson.name?.replace(`/${context.workspaceConfig.namespace}`, "")),
49
- APP_VERSION: context.packageJson.version,
50
- BUILD_ID: context.meta.buildId,
51
- BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),
52
- BUILD_CHECKSUM: context.meta.checksum,
53
- RELEASE_ID: context.meta.releaseId,
54
- RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,
55
- DEFAULT_LOCALE: context.workspaceConfig.locale,
56
- DEFAULT_TIMEZONE: context.workspaceConfig.timezone,
57
- LOG_LEVEL: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
58
- ERROR_URL: context.workspaceConfig.error?.url,
59
- ORGANIZATION: context.config.organization || (isSetObject(context.workspaceConfig.organization) ? context.workspaceConfig.organization.name : context.workspaceConfig.organization),
60
- PLATFORM: context.config.build.platform,
61
- MODE: context.config.mode,
62
- TEST: context.config.mode === "test",
63
- DEBUG: context.config.mode === "development",
64
- STACKTRACE: context.config.mode !== "production",
65
- ENVIRONMENT: !context.environment.name || context.environment.name === DEFAULT_ENVIRONMENT ? context.config.mode : context.environment.name
66
- }, isSetObject(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce((ret, prop) => {
67
- ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();
68
- return ret;
69
- }, {}) : {});
70
- }
71
- async function loadEnv$1(context, options) {
72
- const [project, workspace, config] = await Promise.all([
73
- loadEnvDirectory(options, context.config.projectRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
74
- loadEnvDirectory(options, context.workspaceConfig.workspaceRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
75
- loadEnvDirectory(options, context.envPaths.config, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)
76
- ]);
77
- return defu(loadEnvFromContext(context, process.env), project, workspace, config);
78
- }
79
-
80
- //#endregion
81
- export { loadEnv$1 as loadEnv, loadEnvFromContext };
@@ -1,201 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_capnp = require('../../../deepkit/src/capnp.cjs');
3
- const require_resolve_reflections = require('../../../deepkit/src/resolve-reflections.cjs');
4
- const require_reflection = require('../../../deepkit/schemas/reflection2.cjs');
5
- const require_reflect = require('./reflect.cjs');
6
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
8
- let __stryke_capnp = require("@stryke/capnp");
9
- __stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
10
- let __stryke_fs_buffer = require("@stryke/fs/buffer");
11
- let __stryke_type_checks_is_empty_object = require("@stryke/type-checks/is-empty-object");
12
- let node_fs = require("node:fs");
13
-
14
- //#region ../plugin-env/src/helpers/persistence.ts
15
- /**
16
- * Resolves the runtime type definition file for the environment variables.
17
- *
18
- * @param context - The plugin context.
19
- * @returns The runtime type definition file for the environment variables.
20
- */
21
- async function resolveRuntimeTypeFile(context) {
22
- const resolved = await context.fs.resolve("@powerlines/plugin-env/types/runtime");
23
- if (!resolved) throw new Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);
24
- return resolved;
25
- }
26
- /**
27
- * Gets the default type definition for the environment variables.
28
- *
29
- * @param context - The plugin context.
30
- * @returns The default type definition for the environment variables.
31
- */
32
- async function getEnvDefaultTypeDefinition(context) {
33
- return {
34
- file: await resolveRuntimeTypeFile(context),
35
- name: "EnvInterface"
36
- };
37
- }
38
- /** Gets the default type definition for the environment secrets.
39
- *
40
- * @param context - The plugin context.
41
- * @returns The default type definition for the environment secrets.
42
- */
43
- async function getSecretsDefaultTypeDefinition(context) {
44
- return {
45
- file: await resolveRuntimeTypeFile(context),
46
- name: "SecretsInterface"
47
- };
48
- }
49
- /**
50
- * Gets the path to the environment type reflections.
51
- *
52
- * @param context - The plugin context.
53
- * @param name - The name of the type reflections.
54
- * @returns The path to the environment type reflections.
55
- */
56
- function getEnvTypeReflectionsPath(context, name = "env") {
57
- return (0, __stryke_path_join_paths.joinPaths)(require_resolve_reflections.getReflectionsPath(context), "env", `${name}-types.bin`);
58
- }
59
- /**
60
- * Reads the environment type reflection from the file system.
61
- *
62
- * @param context - The plugin context.
63
- * @param name - The name of the type reflections.
64
- * @returns The environment type reflection.
65
- */
66
- async function readEnvTypeReflection(context, name = "env") {
67
- const filePath = getEnvTypeReflectionsPath(context, name);
68
- if (!(0, node_fs.existsSync)(filePath)) {
69
- if (!context.env.types.env || (0, __stryke_type_checks_is_empty_object.isEmptyObject)(context.env.types.env)) {
70
- const reflection$1 = require_reflect.createEnvReflection(context);
71
- const message = new __stryke_capnp.Message();
72
- reflection$1.messageRoot = message.initRoot(require_reflection.SerializedTypes);
73
- reflection$1.dataBuffer = message.toArrayBuffer();
74
- context.env.types.env = reflection$1;
75
- await writeEnvTypeReflection(context, context.env.types.env, name);
76
- }
77
- return context.env.types.env;
78
- }
79
- const buffer = await (0, __stryke_fs_buffer.readFileBuffer)(filePath);
80
- const messageRoot = new __stryke_capnp.Message(buffer, false).getRoot(require_reflection.SerializedTypes);
81
- const reflection = (0, __powerlines_deepkit_vendor_type.resolveClassType)((0, __powerlines_deepkit_vendor_type.deserializeType)(require_capnp.convertFromCapnp(messageRoot.types)));
82
- context.env.types[name] = reflection;
83
- context.env.types[name].messageRoot = messageRoot;
84
- context.env.types[name].dataBuffer = buffer;
85
- return reflection;
86
- }
87
- /**
88
- * Writes the environment type reflection to the file system.
89
- *
90
- * @param context - The plugin context.
91
- * @param reflection - The environment type reflection to write.
92
- * @param name - The name of the type reflections.
93
- */
94
- async function writeEnvTypeReflection(context, reflection, name = "env") {
95
- const serialized = reflection.serializeType();
96
- const message = new __stryke_capnp.Message();
97
- require_capnp.convertToCapnp(serialized, message.initRoot(require_reflection.SerializedTypes)._initTypes(serialized.length));
98
- await (0, __stryke_fs_buffer.writeFileBuffer)(getEnvTypeReflectionsPath(context, name), message.toArrayBuffer());
99
- }
100
- function getEnvReflectionsPath(context, name) {
101
- return (0, __stryke_path_join_paths.joinPaths)(require_resolve_reflections.getReflectionsPath(context), "env", `${name}.bin`);
102
- }
103
- /**
104
- * Reads the environment reflection data from the file system.
105
- *
106
- * @param context - The plugin context.
107
- * @returns The environment reflection data.
108
- */
109
- async function readEnvReflection(context) {
110
- const filePath = getEnvReflectionsPath(context, "env");
111
- if (!(0, node_fs.existsSync)(filePath)) {
112
- if (!context.env.types.env) context.env.types.env = await readEnvTypeReflection(context, "env");
113
- if (!context.env.used.env || (0, __stryke_type_checks_is_empty_object.isEmptyObject)(context.env.used.env)) {
114
- const reflection$1 = require_reflect.createEnvReflection(context, {
115
- type: {
116
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
117
- typeName: "Env",
118
- description: `An object containing the environment configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
119
- types: []
120
- },
121
- superReflection: context.env.types.env
122
- });
123
- reflection$1.name = "Env";
124
- const message = new __stryke_capnp.Message();
125
- reflection$1.messageRoot = message.initRoot(require_reflection.SerializedTypes);
126
- reflection$1.dataBuffer = message.toArrayBuffer();
127
- context.env.used.env = reflection$1;
128
- await writeEnvReflection(context, context.env.used.env, "env");
129
- }
130
- return context.env.used.env;
131
- }
132
- const buffer = await (0, __stryke_fs_buffer.readFileBuffer)(filePath);
133
- const messageRoot = new __stryke_capnp.Message(buffer, false).getRoot(require_reflection.SerializedTypes);
134
- const reflection = (0, __powerlines_deepkit_vendor_type.resolveClassType)((0, __powerlines_deepkit_vendor_type.deserializeType)(require_capnp.convertFromCapnp(messageRoot.types)));
135
- context.env.used.env = reflection;
136
- context.env.used.env.messageRoot = messageRoot;
137
- context.env.used.env.dataBuffer = buffer;
138
- return reflection;
139
- }
140
- /**
141
- * Reads the secret environment reflection data from the file system.
142
- *
143
- * @param context - The plugin context.
144
- * @returns The environment reflection data.
145
- */
146
- async function readSecretsReflection(context) {
147
- const filePath = getEnvReflectionsPath(context, "secrets");
148
- if (!(0, node_fs.existsSync)(filePath)) {
149
- if (!context.env.types.secrets) context.env.types.secrets = await readEnvTypeReflection(context, "secrets");
150
- if (!context.env.used.secrets || (0, __stryke_type_checks_is_empty_object.isEmptyObject)(context.env.used.secrets)) {
151
- const reflection$1 = require_reflect.createEnvReflection(context, {
152
- type: {
153
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
154
- typeName: "Secrets",
155
- description: `An object containing the secret configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
156
- types: []
157
- },
158
- superReflection: context.env.types.secrets
159
- });
160
- reflection$1.name = "Secrets";
161
- const message = new __stryke_capnp.Message();
162
- reflection$1.messageRoot = message.initRoot(require_reflection.SerializedTypes);
163
- reflection$1.dataBuffer = message.toArrayBuffer();
164
- context.env.used.secrets = reflection$1;
165
- await writeEnvReflection(context, context.env.used.secrets, "secrets");
166
- }
167
- return context.env.used.secrets;
168
- }
169
- const buffer = await (0, __stryke_fs_buffer.readFileBuffer)(filePath);
170
- const messageRoot = new __stryke_capnp.Message(buffer, false).getRoot(require_reflection.SerializedTypes);
171
- const reflection = (0, __powerlines_deepkit_vendor_type.resolveClassType)((0, __powerlines_deepkit_vendor_type.deserializeType)(require_capnp.convertFromCapnp(messageRoot.types)));
172
- context.env.used.secrets = reflection;
173
- context.env.used.secrets.messageRoot = messageRoot;
174
- context.env.used.secrets.dataBuffer = buffer;
175
- return reflection;
176
- }
177
- /**
178
- * Writes the environment reflection data to the file system.
179
- *
180
- * @param context - The plugin context.
181
- * @param reflection - The reflection data to write.
182
- * @param name - The name of the reflection (either "env" or "secrets").
183
- */
184
- async function writeEnvReflection(context, reflection, name = "env") {
185
- const serialized = reflection.serializeType();
186
- const message = new __stryke_capnp.Message();
187
- require_capnp.convertToCapnp(serialized, message.initRoot(require_reflection.SerializedTypes)._initTypes(serialized.length));
188
- await (0, __stryke_fs_buffer.writeFileBuffer)(getEnvReflectionsPath(context, name), message.toArrayBuffer());
189
- }
190
-
191
- //#endregion
192
- exports.getEnvDefaultTypeDefinition = getEnvDefaultTypeDefinition;
193
- exports.getEnvReflectionsPath = getEnvReflectionsPath;
194
- exports.getEnvTypeReflectionsPath = getEnvTypeReflectionsPath;
195
- exports.getSecretsDefaultTypeDefinition = getSecretsDefaultTypeDefinition;
196
- exports.readEnvReflection = readEnvReflection;
197
- exports.readEnvTypeReflection = readEnvTypeReflection;
198
- exports.readSecretsReflection = readSecretsReflection;
199
- exports.resolveRuntimeTypeFile = resolveRuntimeTypeFile;
200
- exports.writeEnvReflection = writeEnvReflection;
201
- exports.writeEnvTypeReflection = writeEnvTypeReflection;
@@ -1,190 +0,0 @@
1
- import { convertFromCapnp, convertToCapnp } from "../../../deepkit/src/capnp.mjs";
2
- import { getReflectionsPath } from "../../../deepkit/src/resolve-reflections.mjs";
3
- import { SerializedTypes } from "../../../deepkit/schemas/reflection2.mjs";
4
- import { createEnvReflection } from "./reflect.mjs";
5
- import { ReflectionKind, deserializeType, resolveClassType } from "@powerlines/deepkit/vendor/type";
6
- import { joinPaths } from "@stryke/path/join-paths";
7
- import * as capnp from "@stryke/capnp";
8
- import { readFileBuffer, writeFileBuffer } from "@stryke/fs/buffer";
9
- import { isEmptyObject } from "@stryke/type-checks/is-empty-object";
10
- import { existsSync } from "node:fs";
11
-
12
- //#region ../plugin-env/src/helpers/persistence.ts
13
- /**
14
- * Resolves the runtime type definition file for the environment variables.
15
- *
16
- * @param context - The plugin context.
17
- * @returns The runtime type definition file for the environment variables.
18
- */
19
- async function resolveRuntimeTypeFile(context) {
20
- const resolved = await context.fs.resolve("@powerlines/plugin-env/types/runtime");
21
- if (!resolved) throw new Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);
22
- return resolved;
23
- }
24
- /**
25
- * Gets the default type definition for the environment variables.
26
- *
27
- * @param context - The plugin context.
28
- * @returns The default type definition for the environment variables.
29
- */
30
- async function getEnvDefaultTypeDefinition(context) {
31
- return {
32
- file: await resolveRuntimeTypeFile(context),
33
- name: "EnvInterface"
34
- };
35
- }
36
- /** Gets the default type definition for the environment secrets.
37
- *
38
- * @param context - The plugin context.
39
- * @returns The default type definition for the environment secrets.
40
- */
41
- async function getSecretsDefaultTypeDefinition(context) {
42
- return {
43
- file: await resolveRuntimeTypeFile(context),
44
- name: "SecretsInterface"
45
- };
46
- }
47
- /**
48
- * Gets the path to the environment type reflections.
49
- *
50
- * @param context - The plugin context.
51
- * @param name - The name of the type reflections.
52
- * @returns The path to the environment type reflections.
53
- */
54
- function getEnvTypeReflectionsPath(context, name = "env") {
55
- return joinPaths(getReflectionsPath(context), "env", `${name}-types.bin`);
56
- }
57
- /**
58
- * Reads the environment type reflection from the file system.
59
- *
60
- * @param context - The plugin context.
61
- * @param name - The name of the type reflections.
62
- * @returns The environment type reflection.
63
- */
64
- async function readEnvTypeReflection(context, name = "env") {
65
- const filePath = getEnvTypeReflectionsPath(context, name);
66
- if (!existsSync(filePath)) {
67
- if (!context.env.types.env || isEmptyObject(context.env.types.env)) {
68
- const reflection$1 = createEnvReflection(context);
69
- const message = new capnp.Message();
70
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
71
- reflection$1.dataBuffer = message.toArrayBuffer();
72
- context.env.types.env = reflection$1;
73
- await writeEnvTypeReflection(context, context.env.types.env, name);
74
- }
75
- return context.env.types.env;
76
- }
77
- const buffer = await readFileBuffer(filePath);
78
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
79
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
80
- context.env.types[name] = reflection;
81
- context.env.types[name].messageRoot = messageRoot;
82
- context.env.types[name].dataBuffer = buffer;
83
- return reflection;
84
- }
85
- /**
86
- * Writes the environment type reflection to the file system.
87
- *
88
- * @param context - The plugin context.
89
- * @param reflection - The environment type reflection to write.
90
- * @param name - The name of the type reflections.
91
- */
92
- async function writeEnvTypeReflection(context, reflection, name = "env") {
93
- const serialized = reflection.serializeType();
94
- const message = new capnp.Message();
95
- convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
96
- await writeFileBuffer(getEnvTypeReflectionsPath(context, name), message.toArrayBuffer());
97
- }
98
- function getEnvReflectionsPath(context, name) {
99
- return joinPaths(getReflectionsPath(context), "env", `${name}.bin`);
100
- }
101
- /**
102
- * Reads the environment reflection data from the file system.
103
- *
104
- * @param context - The plugin context.
105
- * @returns The environment reflection data.
106
- */
107
- async function readEnvReflection(context) {
108
- const filePath = getEnvReflectionsPath(context, "env");
109
- if (!existsSync(filePath)) {
110
- if (!context.env.types.env) context.env.types.env = await readEnvTypeReflection(context, "env");
111
- if (!context.env.used.env || isEmptyObject(context.env.used.env)) {
112
- const reflection$1 = createEnvReflection(context, {
113
- type: {
114
- kind: ReflectionKind.objectLiteral,
115
- typeName: "Env",
116
- description: `An object containing the environment configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
117
- types: []
118
- },
119
- superReflection: context.env.types.env
120
- });
121
- reflection$1.name = "Env";
122
- const message = new capnp.Message();
123
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
124
- reflection$1.dataBuffer = message.toArrayBuffer();
125
- context.env.used.env = reflection$1;
126
- await writeEnvReflection(context, context.env.used.env, "env");
127
- }
128
- return context.env.used.env;
129
- }
130
- const buffer = await readFileBuffer(filePath);
131
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
132
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
133
- context.env.used.env = reflection;
134
- context.env.used.env.messageRoot = messageRoot;
135
- context.env.used.env.dataBuffer = buffer;
136
- return reflection;
137
- }
138
- /**
139
- * Reads the secret environment reflection data from the file system.
140
- *
141
- * @param context - The plugin context.
142
- * @returns The environment reflection data.
143
- */
144
- async function readSecretsReflection(context) {
145
- const filePath = getEnvReflectionsPath(context, "secrets");
146
- if (!existsSync(filePath)) {
147
- if (!context.env.types.secrets) context.env.types.secrets = await readEnvTypeReflection(context, "secrets");
148
- if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {
149
- const reflection$1 = createEnvReflection(context, {
150
- type: {
151
- kind: ReflectionKind.objectLiteral,
152
- typeName: "Secrets",
153
- description: `An object containing the secret configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
154
- types: []
155
- },
156
- superReflection: context.env.types.secrets
157
- });
158
- reflection$1.name = "Secrets";
159
- const message = new capnp.Message();
160
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
161
- reflection$1.dataBuffer = message.toArrayBuffer();
162
- context.env.used.secrets = reflection$1;
163
- await writeEnvReflection(context, context.env.used.secrets, "secrets");
164
- }
165
- return context.env.used.secrets;
166
- }
167
- const buffer = await readFileBuffer(filePath);
168
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
169
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
170
- context.env.used.secrets = reflection;
171
- context.env.used.secrets.messageRoot = messageRoot;
172
- context.env.used.secrets.dataBuffer = buffer;
173
- return reflection;
174
- }
175
- /**
176
- * Writes the environment reflection data to the file system.
177
- *
178
- * @param context - The plugin context.
179
- * @param reflection - The reflection data to write.
180
- * @param name - The name of the reflection (either "env" or "secrets").
181
- */
182
- async function writeEnvReflection(context, reflection, name = "env") {
183
- const serialized = reflection.serializeType();
184
- const message = new capnp.Message();
185
- convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
186
- await writeFileBuffer(getEnvReflectionsPath(context, name), message.toArrayBuffer());
187
- }
188
-
189
- //#endregion
190
- export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvTypeReflection };