astro 4.10.1 → 4.10.3

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 (68) hide show
  1. package/dist/@types/astro.d.ts +43 -39
  2. package/dist/config/index.d.ts +2 -2
  3. package/dist/config/index.js +4 -4
  4. package/dist/container/index.d.ts +32 -1
  5. package/dist/container/index.js +45 -0
  6. package/dist/container/pipeline.d.ts +1 -1
  7. package/dist/container/pipeline.js +17 -18
  8. package/dist/container/vite-plugin-container.d.ts +2 -0
  9. package/dist/container/vite-plugin-container.js +15 -0
  10. package/dist/content/runtime.js +2 -2
  11. package/dist/content/types-generator.js +30 -32
  12. package/dist/content/utils.d.ts +11 -0
  13. package/dist/content/utils.js +49 -0
  14. package/dist/content/vite-plugin-content-imports.d.ts +3 -1
  15. package/dist/content/vite-plugin-content-imports.js +15 -4
  16. package/dist/core/app/index.js +0 -4
  17. package/dist/core/app/pipeline.d.ts +1 -1
  18. package/dist/core/app/pipeline.js +4 -4
  19. package/dist/core/base-pipeline.d.ts +1 -1
  20. package/dist/core/base-pipeline.js +1 -1
  21. package/dist/core/build/generate.js +2 -1
  22. package/dist/core/build/internal.d.ts +4 -0
  23. package/dist/core/build/internal.js +2 -1
  24. package/dist/core/build/page-data.js +2 -4
  25. package/dist/core/build/pipeline.d.ts +1 -1
  26. package/dist/core/build/pipeline.js +4 -4
  27. package/dist/core/build/plugins/plugin-chunks.js +6 -0
  28. package/dist/core/build/plugins/plugin-prerender.js +55 -48
  29. package/dist/core/build/plugins/plugin-ssr.js +15 -12
  30. package/dist/core/build/static-build.js +36 -44
  31. package/dist/core/build/types.d.ts +0 -1
  32. package/dist/core/config/schema.d.ts +422 -78
  33. package/dist/core/constants.d.ts +4 -0
  34. package/dist/core/constants.js +3 -1
  35. package/dist/core/create-vite.js +4 -2
  36. package/dist/core/dev/dev.js +1 -1
  37. package/dist/core/errors/errors-data.d.ts +31 -0
  38. package/dist/core/errors/errors-data.js +12 -0
  39. package/dist/core/messages.js +2 -2
  40. package/dist/core/render-context.d.ts +1 -1
  41. package/dist/core/render-context.js +28 -22
  42. package/dist/core/routing/astro-designed-error-pages.d.ts +1 -0
  43. package/dist/core/routing/astro-designed-error-pages.js +15 -1
  44. package/dist/core/routing/params.js +1 -1
  45. package/dist/core/util.js +5 -2
  46. package/dist/env/config.d.ts +2 -1
  47. package/dist/env/config.js +4 -0
  48. package/dist/env/constants.d.ts +0 -1
  49. package/dist/env/constants.js +0 -2
  50. package/dist/env/runtime.d.ts +3 -1
  51. package/dist/env/runtime.js +8 -1
  52. package/dist/env/schema.d.ts +198 -220
  53. package/dist/env/schema.js +47 -79
  54. package/dist/env/validators.js +73 -10
  55. package/dist/env/vite-plugin-env.js +15 -15
  56. package/dist/i18n/index.d.ts +1 -1
  57. package/dist/i18n/index.js +4 -11
  58. package/dist/jsx/server.d.ts +3 -5
  59. package/dist/jsx/server.js +3 -1
  60. package/dist/runtime/server/render/astro/render.js +8 -2
  61. package/dist/vite-plugin-astro/index.js +1 -1
  62. package/dist/vite-plugin-astro-server/pipeline.d.ts +1 -1
  63. package/dist/vite-plugin-astro-server/pipeline.js +4 -4
  64. package/dist/vite-plugin-astro-server/request.js +2 -2
  65. package/dist/vite-plugin-astro-server/route.js +18 -1
  66. package/package.json +16 -16
  67. package/templates/env/module.mjs +14 -5
  68. package/templates/env/types.d.ts +1 -12
@@ -27,6 +27,10 @@ export declare const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
27
27
  * The value of the `component` field of the default 404 page, which is used when there is no user-provided 404.astro page.
28
28
  */
29
29
  export declare const DEFAULT_404_COMPONENT = "astro-default-404.astro";
30
+ /**
31
+ * The value of the `component` field of the default 500 page, which is used when there is no user-provided 404.astro page.
32
+ */
33
+ export declare const DEFAULT_500_COMPONENT = "astro-default-500.astro";
30
34
  /**
31
35
  * A response with one of these status codes will be rewritten
32
36
  * with the result of rendering the respective error page.
@@ -1,7 +1,8 @@
1
- const ASTRO_VERSION = "4.10.1";
1
+ const ASTRO_VERSION = "4.10.3";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
4
  const DEFAULT_404_COMPONENT = "astro-default-404.astro";
5
+ const DEFAULT_500_COMPONENT = "astro-default-500.astro";
5
6
  const REROUTABLE_STATUS_CODES = [404, 500];
6
7
  const clientAddressSymbol = Symbol.for("astro.clientAddress");
7
8
  const clientLocalsSymbol = Symbol.for("astro.locals");
@@ -18,6 +19,7 @@ const MIDDLEWARE_PATH_SEGMENT_NAME = "middleware";
18
19
  export {
19
20
  ASTRO_VERSION,
20
21
  DEFAULT_404_COMPONENT,
22
+ DEFAULT_500_COMPONENT,
21
23
  MIDDLEWARE_PATH_SEGMENT_NAME,
22
24
  REROUTABLE_STATUS_CODES,
23
25
  REROUTE_DIRECTIVE_HEADER,
@@ -5,6 +5,7 @@ import * as vite from "vite";
5
5
  import { crawlFrameworkPkgs } from "vitefu";
6
6
  import { getAssetsPrefix } from "../assets/utils/getAssetsPrefix.js";
7
7
  import astroAssetsPlugin from "../assets/vite-plugin-assets.js";
8
+ import astroContainer from "../container/vite-plugin-container.js";
8
9
  import {
9
10
  astroContentAssetPropagationPlugin,
10
11
  astroContentImportPlugin,
@@ -122,7 +123,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
122
123
  astroScannerPlugin({ settings, logger }),
123
124
  astroInjectEnvTsPlugin({ settings, logger, fs }),
124
125
  astroContentVirtualModPlugin({ fs, settings }),
125
- astroContentImportPlugin({ fs, settings }),
126
+ astroContentImportPlugin({ fs, settings, logger }),
126
127
  astroContentAssetPropagationPlugin({ mode, settings }),
127
128
  vitePluginMiddleware({ settings }),
128
129
  vitePluginSSRManifest(),
@@ -131,7 +132,8 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
131
132
  astroTransitions({ settings }),
132
133
  astroDevToolbar({ settings, logger }),
133
134
  vitePluginFileURL({}),
134
- astroInternationalization({ settings })
135
+ astroInternationalization({ settings }),
136
+ astroContainer()
135
137
  ],
136
138
  publicDir: fileURLToPath(settings.config.publicDir),
137
139
  root: fileURLToPath(settings.config.root),
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
19
19
  await telemetry.record([]);
20
20
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
21
21
  const logger = restart.container.logger;
22
- const currentVersion = "4.10.1";
22
+ const currentVersion = "4.10.3";
23
23
  const isPrerelease = currentVersion.includes("-");
24
24
  if (!isPrerelease) {
25
25
  try {
@@ -1068,6 +1068,17 @@ export declare const i18nNotEnabled: {
1068
1068
  message: string;
1069
1069
  hint: string;
1070
1070
  };
1071
+ /**
1072
+ * @docs
1073
+ * @description
1074
+ * An i18n utility tried to use the locale from a URL path that does not contain one. You can prevent this error by using pathHasLocale to check URLs for a locale first before using i18n utilities.
1075
+ *
1076
+ */
1077
+ export declare const i18nNoLocaleFoundInPath: {
1078
+ name: string;
1079
+ title: string;
1080
+ message: string;
1081
+ };
1071
1082
  /**
1072
1083
  * @docs
1073
1084
  * @description
@@ -1118,6 +1129,26 @@ export declare const ServerOnlyModule: {
1118
1129
  title: string;
1119
1130
  message: (name: string) => string;
1120
1131
  };
1132
+ /**
1133
+ * @docs
1134
+ * @description
1135
+ * `Astro.rewrite()` cannot be used if the request body has already been read. If you need to read the body, first clone the request. For example:
1136
+ *
1137
+ * ```js
1138
+ * const data = await Astro.request.clone().formData();
1139
+ *
1140
+ * Astro.rewrite("/target")
1141
+ * ```
1142
+ *
1143
+ * @see
1144
+ * - [Request.clone()](https://developer.mozilla.org/en-US/docs/Web/API/Request/clone)
1145
+ * - [Astro.rewrite](https://docs.astro.build/en/reference/configuration-reference/#experimentalrewriting)
1146
+ */
1147
+ export declare const RewriteWithBodyUsed: {
1148
+ name: string;
1149
+ title: string;
1150
+ message: string;
1151
+ };
1121
1152
  /**
1122
1153
  * @docs
1123
1154
  * @kind heading
@@ -385,6 +385,11 @@ const i18nNotEnabled = {
385
385
  message: "The `astro:i18n` module can not be used without enabling i18n in your Astro config.",
386
386
  hint: "See https://docs.astro.build/en/guides/internationalization for a guide on setting up i18n."
387
387
  };
388
+ const i18nNoLocaleFoundInPath = {
389
+ name: "i18nNoLocaleFoundInPath",
390
+ title: "The path doesn't contain any locale",
391
+ message: "You tried to use an i18n utility on a path that doesn't contain any locale. You can use `pathHasLocale` first to determine if the path has a locale."
392
+ };
388
393
  const RouteNotFound = {
389
394
  name: "RouteNotFound",
390
395
  title: "Route not found.",
@@ -413,6 +418,11 @@ const ServerOnlyModule = {
413
418
  title: "Module is only available server-side",
414
419
  message: (name) => `The "${name}" module is only available server-side.`
415
420
  };
421
+ const RewriteWithBodyUsed = {
422
+ name: "RewriteWithBodyUsed",
423
+ title: "Cannot use Astro.rewrite after the request body has been read",
424
+ message: "Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request."
425
+ };
416
426
  const UnknownCSSError = {
417
427
  name: "UnknownCSSError",
418
428
  title: "Unknown CSS Error."
@@ -626,6 +636,7 @@ export {
626
636
  ReservedSlotName,
627
637
  ResponseSentError,
628
638
  RewriteEncounteredAnError,
639
+ RewriteWithBodyUsed,
629
640
  RouteNotFound,
630
641
  ServerOnlyModule,
631
642
  StaticClientAddressNotAvailable,
@@ -642,5 +653,6 @@ export {
642
653
  UnsupportedConfigTransformError,
643
654
  UnsupportedImageConversion,
644
655
  UnsupportedImageFormat,
656
+ i18nNoLocaleFoundInPath,
645
657
  i18nNotEnabled
646
658
  };
@@ -37,7 +37,7 @@ function serverStart({
37
37
  host,
38
38
  base
39
39
  }) {
40
- const version = "4.10.1";
40
+ const version = "4.10.3";
41
41
  const localPrefix = `${dim("\u2503")} Local `;
42
42
  const networkPrefix = `${dim("\u2503")} Network `;
43
43
  const emptyPrefix = " ".repeat(11);
@@ -269,7 +269,7 @@ function printHelp({
269
269
  message.push(
270
270
  linebreak(),
271
271
  ` ${bgGreen(black(` ${commandName} `))} ${green(
272
- `v${"4.10.1"}`
272
+ `v${"4.10.3"}`
273
273
  )} ${headline}`
274
274
  );
275
275
  }
@@ -11,7 +11,7 @@ export declare class RenderContext {
11
11
  readonly pipeline: Pipeline;
12
12
  locals: App.Locals;
13
13
  readonly middleware: MiddlewareHandler;
14
- readonly pathname: string;
14
+ pathname: string;
15
15
  request: Request;
16
16
  routeData: RouteData;
17
17
  status: number;
@@ -8,7 +8,6 @@ import { renderEndpoint } from "../runtime/server/endpoint.js";
8
8
  import { renderPage } from "../runtime/server/index.js";
9
9
  import {
10
10
  ASTRO_VERSION,
11
- DEFAULT_404_COMPONENT,
12
11
  REROUTE_DIRECTIVE_HEADER,
13
12
  ROUTE_TYPE_HEADER,
14
13
  clientAddressSymbol,
@@ -77,13 +76,13 @@ class RenderContext {
77
76
  * - fallback
78
77
  */
79
78
  async render(componentInstance, slots = {}) {
80
- const { cookies, middleware, pathname, pipeline } = this;
81
- const { logger, routeCache, serverLike, streaming } = pipeline;
79
+ const { cookies, middleware, pipeline } = this;
80
+ const { logger, serverLike, streaming } = pipeline;
82
81
  const props = Object.keys(this.props).length > 0 ? this.props : await getProps({
83
82
  mod: componentInstance,
84
83
  routeData: this.routeData,
85
- routeCache,
86
- pathname,
84
+ routeCache: this.pipeline.routeCache,
85
+ pathname: this.pathname,
87
86
  logger,
88
87
  serverLike
89
88
  });
@@ -173,7 +172,7 @@ class RenderContext {
173
172
  const redirect = (path, status = 302) => new Response(null, { status, headers: { Location: path } });
174
173
  const rewrite = async (reroutePayload) => {
175
174
  pipeline.logger.debug("router", "Called rewriting to:", reroutePayload);
176
- const [routeData, component] = await pipeline.tryRewrite(
175
+ const [routeData, component, newURL] = await pipeline.tryRewrite(
177
176
  reroutePayload,
178
177
  this.request,
179
178
  this.originalRoute
@@ -182,15 +181,13 @@ class RenderContext {
182
181
  if (reroutePayload instanceof Request) {
183
182
  this.request = reroutePayload;
184
183
  } else {
185
- this.request = this.#copyRequest(
186
- new URL(routeData.pathname ?? routeData.route, this.url.origin),
187
- this.request
188
- );
184
+ this.request = this.#copyRequest(newURL, this.request);
189
185
  }
190
- this.url = new URL(this.request.url);
186
+ this.url = newURL;
191
187
  this.cookies = new AstroCookies(this.request);
192
- this.params = getParams(routeData, url.toString());
188
+ this.params = getParams(routeData, this.url.pathname);
193
189
  this.isRewriting = true;
190
+ this.pathname = this.url.pathname;
194
191
  return await this.render(component);
195
192
  };
196
193
  return {
@@ -289,10 +286,18 @@ class RenderContext {
289
286
  * The page level partial is used as the prototype of the user-visible `Astro` global object, which is instantiated once per use of a component.
290
287
  */
291
288
  createAstro(result, astroStaticPartial, props, slotValues) {
292
- const astroPagePartial = this.#astroPagePartial ??= this.createAstroPagePartial(
293
- result,
294
- astroStaticPartial
295
- );
289
+ let astroPagePartial;
290
+ if (this.isRewriting) {
291
+ astroPagePartial = this.#astroPagePartial = this.createAstroPagePartial(
292
+ result,
293
+ astroStaticPartial
294
+ );
295
+ } else {
296
+ astroPagePartial = this.#astroPagePartial ??= this.createAstroPagePartial(
297
+ result,
298
+ astroStaticPartial
299
+ );
300
+ }
296
301
  const astroComponentPartial = { props, self: null };
297
302
  const Astro = Object.assign(
298
303
  Object.create(astroPagePartial),
@@ -327,7 +332,7 @@ class RenderContext {
327
332
  };
328
333
  const rewrite = async (reroutePayload) => {
329
334
  pipeline.logger.debug("router", "Calling rewrite: ", reroutePayload);
330
- const [routeData, component] = await pipeline.tryRewrite(
335
+ const [routeData, component, newURL] = await pipeline.tryRewrite(
331
336
  reroutePayload,
332
337
  this.request,
333
338
  this.originalRoute
@@ -336,14 +341,12 @@ class RenderContext {
336
341
  if (reroutePayload instanceof Request) {
337
342
  this.request = reroutePayload;
338
343
  } else {
339
- this.request = this.#copyRequest(
340
- new URL(routeData.pathname ?? routeData.route, this.url.origin),
341
- this.request
342
- );
344
+ this.request = this.#copyRequest(newURL, this.request);
343
345
  }
344
346
  this.url = new URL(this.request.url);
345
347
  this.cookies = new AstroCookies(this.request);
346
- this.params = getParams(routeData, url.toString());
348
+ this.params = getParams(routeData, this.url.pathname);
349
+ this.pathname = this.url.pathname;
347
350
  this.isRewriting = true;
348
351
  return await this.render(component);
349
352
  };
@@ -433,6 +436,9 @@ class RenderContext {
433
436
  * @param oldRequest The old `Request`
434
437
  */
435
438
  #copyRequest(newUrl, oldRequest) {
439
+ if (oldRequest.bodyUsed) {
440
+ throw new AstroError(AstroErrorData.RewriteWithBodyUsed);
441
+ }
436
442
  return new Request(newUrl, {
437
443
  method: oldRequest.method,
438
444
  headers: oldRequest.headers,
@@ -1,5 +1,6 @@
1
1
  import type { ManifestData, RouteData } from '../../@types/astro.js';
2
2
  export declare const DEFAULT_404_ROUTE: RouteData;
3
+ export declare const DEFAULT_500_ROUTE: RouteData;
3
4
  export declare function ensure404Route(manifest: ManifestData): ManifestData;
4
5
  export declare function default404Page({ pathname }: {
5
6
  pathname: string;
@@ -1,5 +1,5 @@
1
1
  import notFoundTemplate from "../../template/4xx.js";
2
- import { DEFAULT_404_COMPONENT } from "../constants.js";
2
+ import { DEFAULT_404_COMPONENT, DEFAULT_500_COMPONENT } from "../constants.js";
3
3
  const DEFAULT_404_ROUTE = {
4
4
  component: DEFAULT_404_COMPONENT,
5
5
  generate: () => "",
@@ -13,6 +13,19 @@ const DEFAULT_404_ROUTE = {
13
13
  fallbackRoutes: [],
14
14
  isIndex: false
15
15
  };
16
+ const DEFAULT_500_ROUTE = {
17
+ component: DEFAULT_500_COMPONENT,
18
+ generate: () => "",
19
+ params: [],
20
+ pattern: /\/500/,
21
+ prerender: false,
22
+ pathname: "/500",
23
+ segments: [[{ content: "500", dynamic: false, spread: false }]],
24
+ type: "page",
25
+ route: "/500",
26
+ fallbackRoutes: [],
27
+ isIndex: false
28
+ };
16
29
  function ensure404Route(manifest) {
17
30
  if (!manifest.routes.some((route) => route.route === "/404")) {
18
31
  manifest.routes.push(DEFAULT_404_ROUTE);
@@ -33,6 +46,7 @@ async function default404Page({ pathname }) {
33
46
  default404Page.isAstroComponentFactory = true;
34
47
  export {
35
48
  DEFAULT_404_ROUTE,
49
+ DEFAULT_500_ROUTE,
36
50
  default404Page,
37
51
  ensure404Route
38
52
  };
@@ -9,7 +9,7 @@ function stringifyParams(params, route) {
9
9
  }
10
10
  return acc;
11
11
  }, {});
12
- return JSON.stringify(route.generate(validatedParams));
12
+ return route.generate(validatedParams);
13
13
  }
14
14
  export {
15
15
  stringifyParams
package/dist/core/util.js CHANGED
@@ -78,8 +78,11 @@ function isInjectedRoute(file, settings) {
78
78
  return false;
79
79
  }
80
80
  function isPublicRoute(file, config) {
81
- const pagesDir = resolvePages(config);
82
- const parts = file.toString().replace(pagesDir.toString(), "").split("/").slice(1);
81
+ const rootDir = config.root.toString();
82
+ const pagesDir = resolvePages(config).toString();
83
+ const fileDir = file.toString();
84
+ const normalizedDir = fileDir.startsWith(pagesDir) ? fileDir.slice(pagesDir.length) : fileDir.slice(rootDir.length);
85
+ const parts = normalizedDir.replace(pagesDir.toString(), "").split("/").slice(1);
83
86
  for (const part of parts) {
84
87
  if (part.startsWith("_")) return false;
85
88
  }
@@ -1,4 +1,4 @@
1
- import type { BooleanField, BooleanFieldInput, NumberField, NumberFieldInput, StringField, StringFieldInput } from './schema.js';
1
+ import type { BooleanField, BooleanFieldInput, EnumField, EnumFieldInput, NumberField, NumberFieldInput, StringField, StringFieldInput } from './schema.js';
2
2
  /**
3
3
  * Return a valid env field to use in this Astro config for `experimental.env.schema`.
4
4
  */
@@ -6,4 +6,5 @@ export declare const envField: {
6
6
  string: (options: StringFieldInput) => StringField;
7
7
  number: (options: NumberFieldInput) => NumberField;
8
8
  boolean: (options: BooleanFieldInput) => BooleanField;
9
+ enum: <T extends string>(options: EnumFieldInput<T>) => EnumField;
9
10
  };
@@ -10,6 +10,10 @@ const envField = {
10
10
  boolean: (options) => ({
11
11
  ...options,
12
12
  type: "boolean"
13
+ }),
14
+ enum: (options) => ({
15
+ ...options,
16
+ type: "enum"
13
17
  })
14
18
  };
15
19
  export {
@@ -4,7 +4,6 @@ export declare const VIRTUAL_MODULES_IDS: {
4
4
  internal: string;
5
5
  };
6
6
  export declare const VIRTUAL_MODULES_IDS_VALUES: Set<string>;
7
- export declare const PUBLIC_PREFIX = "PUBLIC_";
8
7
  export declare const ENV_TYPES_FILE = "env.d.ts";
9
8
  export declare const MODULE_TEMPLATE_URL: URL;
10
9
  export declare const TYPES_TEMPLATE_URL: URL;
@@ -4,7 +4,6 @@ const VIRTUAL_MODULES_IDS = {
4
4
  internal: "virtual:astro:env/internal"
5
5
  };
6
6
  const VIRTUAL_MODULES_IDS_VALUES = new Set(Object.values(VIRTUAL_MODULES_IDS));
7
- const PUBLIC_PREFIX = "PUBLIC_";
8
7
  const ENV_TYPES_FILE = "env.d.ts";
9
8
  const PKG_BASE = new URL("../../", import.meta.url);
10
9
  const MODULE_TEMPLATE_URL = new URL("templates/env/module.mjs", PKG_BASE);
@@ -12,7 +11,6 @@ const TYPES_TEMPLATE_URL = new URL("templates/env/types.d.ts", PKG_BASE);
12
11
  export {
13
12
  ENV_TYPES_FILE,
14
13
  MODULE_TEMPLATE_URL,
15
- PUBLIC_PREFIX,
16
14
  TYPES_TEMPLATE_URL,
17
15
  VIRTUAL_MODULES_IDS,
18
16
  VIRTUAL_MODULES_IDS_VALUES
@@ -1,6 +1,8 @@
1
1
  import { AstroError, AstroErrorData } from '../core/errors/index.js';
2
2
  export { validateEnvVariable } from './validators.js';
3
3
  export type GetEnv = (key: string) => string | undefined;
4
- export declare function setGetEnv(fn: GetEnv): void;
4
+ export declare function setGetEnv(fn: GetEnv, reset?: boolean): void;
5
+ declare let _onSetGetEnv: (reset: boolean) => void;
6
+ export declare function setOnSetGetEnv(fn: typeof _onSetGetEnv): void;
5
7
  export declare function getEnv(...args: Parameters<GetEnv>): string | undefined;
6
8
  export declare function createInvalidVariableError(...args: Parameters<typeof AstroErrorData.EnvInvalidVariable.message>): AstroError;
@@ -1,8 +1,14 @@
1
1
  import { AstroError, AstroErrorData } from "../core/errors/index.js";
2
2
  import { validateEnvVariable } from "./validators.js";
3
3
  let _getEnv = (key) => process.env[key];
4
- function setGetEnv(fn) {
4
+ function setGetEnv(fn, reset = false) {
5
5
  _getEnv = fn;
6
+ _onSetGetEnv(reset);
7
+ }
8
+ let _onSetGetEnv = (reset) => {
9
+ };
10
+ function setOnSetGetEnv(fn) {
11
+ _onSetGetEnv = fn;
6
12
  }
7
13
  function getEnv(...args) {
8
14
  return _getEnv(...args);
@@ -17,5 +23,6 @@ export {
17
23
  createInvalidVariableError,
18
24
  getEnv,
19
25
  setGetEnv,
26
+ setOnSetGetEnv,
20
27
  validateEnvVariable
21
28
  };