tyfigo 0.1.0-next.d3c2bea.0 → 0.1.0-next.ddcaab3.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 (64) hide show
  1. package/dist/bun.d.mts +1 -1
  2. package/dist/bun.mjs +6 -4
  3. package/dist/bun.mjs.map +1 -1
  4. package/dist/effect.d.mts +3 -2
  5. package/dist/effect.mjs +2 -2
  6. package/dist/{resolve-BeFHJeZb.d.mts → index-CM4xg0II.d.mts} +8 -50
  7. package/dist/index.d.mts +3 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/{runtime-BuQk1xsn.mjs → load-BqGJgpfo.mjs} +35 -10
  10. package/dist/load-BqGJgpfo.mjs.map +1 -0
  11. package/dist/load-CKIE0mVT.d.mts +53 -0
  12. package/dist/plugins/esbuild.d.mts +5 -0
  13. package/dist/plugins/esbuild.mjs +6 -0
  14. package/dist/plugins/esbuild.mjs.map +1 -0
  15. package/dist/plugins/jest.d.mts +10 -0
  16. package/dist/plugins/jest.mjs +29 -0
  17. package/dist/plugins/jest.mjs.map +1 -0
  18. package/dist/plugins/loader.d.mts +15 -0
  19. package/dist/plugins/loader.mjs +21 -0
  20. package/dist/plugins/loader.mjs.map +1 -0
  21. package/dist/plugins/next.d.mts +21 -0
  22. package/dist/plugins/next.mjs +121 -0
  23. package/dist/plugins/next.mjs.map +1 -0
  24. package/dist/plugins/rolldown.d.mts +5 -0
  25. package/dist/plugins/rolldown.mjs +6 -0
  26. package/dist/plugins/rolldown.mjs.map +1 -0
  27. package/dist/plugins/rollup.d.mts +5 -0
  28. package/dist/plugins/rollup.mjs +6 -0
  29. package/dist/plugins/rollup.mjs.map +1 -0
  30. package/dist/plugins/rsbuild.d.mts +5 -0
  31. package/dist/plugins/rsbuild.mjs +6 -0
  32. package/dist/plugins/rsbuild.mjs.map +1 -0
  33. package/dist/plugins/rspack.d.mts +5 -0
  34. package/dist/plugins/rspack.mjs +6 -0
  35. package/dist/plugins/rspack.mjs.map +1 -0
  36. package/dist/plugins/vite.d.mts +5 -0
  37. package/dist/plugins/vite.mjs +6 -0
  38. package/dist/plugins/vite.mjs.map +1 -0
  39. package/dist/plugins/webpack.d.mts +5 -0
  40. package/dist/plugins/webpack.mjs +6 -0
  41. package/dist/plugins/webpack.mjs.map +1 -0
  42. package/dist/register.mjs +1 -1
  43. package/dist/{resolve-CDWA58rz.mjs → resolve-B7e2uGDa.mjs} +82 -100
  44. package/dist/resolve-B7e2uGDa.mjs.map +1 -0
  45. package/dist/resolve-BUtCDolX.d.mts +65 -0
  46. package/dist/resolve-hzoKURuJ.mjs +72 -0
  47. package/dist/resolve-hzoKURuJ.mjs.map +1 -0
  48. package/dist/runtime/index.d.mts +3 -44
  49. package/dist/runtime/index.mjs +4 -3
  50. package/dist/runtime-la_KkjCS.mjs +1 -0
  51. package/dist/{schema-C31aywfc.mjs → schema-C_damFGy.mjs} +3 -2
  52. package/dist/{schema-C31aywfc.mjs.map → schema-C_damFGy.mjs.map} +1 -1
  53. package/dist/{schema-CNquZBC8.d.mts → schema-CkQRd2Uf.d.mts} +3 -2
  54. package/dist/shared-BuRtKsWB.mjs +16 -0
  55. package/dist/shared-BuRtKsWB.mjs.map +1 -0
  56. package/dist/shared-CLa0Be_8.d.mts +22 -0
  57. package/dist/sync-DUNHC9W6.mjs +14 -0
  58. package/dist/sync-DUNHC9W6.mjs.map +1 -0
  59. package/dist/unplugin-DXVarwkX.mjs +69 -0
  60. package/dist/unplugin-DXVarwkX.mjs.map +1 -0
  61. package/dist/unplugin-ce5g3K3a.d.mts +2 -0
  62. package/package.json +95 -1
  63. package/dist/resolve-CDWA58rz.mjs.map +0 -1
  64. package/dist/runtime-BuQk1xsn.mjs.map +0 -1
package/dist/bun.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BunPlugin } from "bun";
2
2
  /**
3
3
  * The tyfigo Bun plugin. Importing `tyfigo/bun` (a `bunfig.toml` `preload`) registers it for the runtime and `bun test`; pass
4
- * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config.
4
+ * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config and a server target inlines the config files and reads `.env` files when it runs.
5
5
  */
6
6
  export declare const tyfigo: () => BunPlugin;
7
7
  //# sourceMappingURL=bun.d.mts.map
package/dist/bun.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as configSuffixes, u as formatProblems } from "./placeholders-MqW2KO9Z.mjs";
2
- import { t as load } from "./runtime-BuQk1xsn.mjs";
2
+ import { t as load } from "./load-BqGJgpfo.mjs";
3
3
  import { extname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { plugin } from "bun";
@@ -8,16 +8,18 @@ const runtime = fileURLToPath(new URL(`runtime/index${extname(import.meta.url)}`
8
8
  const filter = new RegExp(`[^/\\\\](?:${configSuffixes.map((suffix) => suffix.replaceAll(".", "\\.")).join("|")})$`);
9
9
  /**
10
10
  * The tyfigo Bun plugin. Importing `tyfigo/bun` (a `bunfig.toml` `preload`) registers it for the runtime and `bun test`; pass
11
- * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config.
11
+ * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config and a server target inlines the config files and reads `.env` files when it runs.
12
12
  */
13
13
  const tyfigo = () => ({
14
14
  name: "tyfigo",
15
15
  setup(build) {
16
- const target = build.config?.target === "browser" ? "browser" : "server";
16
+ const config = build.config;
17
+ const target = config?.target === "browser" ? "browser" : "server";
17
18
  build.onLoad({ filter }, ({ path }) => {
18
19
  const result = load(path, {
19
20
  target,
20
- runtime
21
+ runtime,
22
+ bundle: config !== void 0
21
23
  });
22
24
  if (result.problems.length > 0) throw new Error(`Invalid config ${path}\n${formatProblems(result.problems)}`);
23
25
  return {
package/dist/bun.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.mjs","names":[],"sources":["../src/bun.ts"],"sourcesContent":["import { extname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { plugin } from 'bun';\n\nimport { configSuffixes, formatProblems } from './core/index.ts';\nimport { load } from './runtime/index.ts';\n\nimport type { BunPlugin } from 'bun';\n\n// The runtime next to this module, so it resolves from config files outside the dependency tree: `.ts` in this repo, `.mjs` once built.\nconst runtime = fileURLToPath(new URL(`runtime/index${extname(import.meta.url)}`, import.meta.url));\n\nconst filter = new RegExp(`[^/\\\\\\\\](?:${configSuffixes.map((suffix) => suffix.replaceAll('.', '\\\\.')).join('|')})$`);\n\n/**\n * The tyfigo Bun plugin. Importing `tyfigo/bun` (a `bunfig.toml` `preload`) registers it for the runtime and `bun test`; pass\n * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config.\n */\nexport const tyfigo = (): BunPlugin => ({\n\tname: 'tyfigo',\n\tsetup(build) {\n\t\tconst target = (build.config as typeof build.config | undefined)?.target === 'browser' ? 'browser' : 'server';\n\t\tbuild.onLoad({ filter }, ({ path }) => {\n\t\t\tconst result = load(path, { target, runtime });\n\t\t\tif (result.problems.length > 0) {\n\t\t\t\tthrow new Error(`Invalid config ${path}\\n${formatProblems(result.problems)}`);\n\t\t\t}\n\t\t\treturn { contents: result.code, loader: 'js' };\n\t\t});\n\t},\n});\n\nvoid plugin(tyfigo());\n"],"mappings":";;;;;;AAWA,MAAM,UAAU,cAAc,IAAI,IAAI,gBAAgB,QAAQ,YAAY,GAAG,KAAK,YAAY,GAAG,CAAC;AAElG,MAAM,SAAS,IAAI,OAAO,cAAc,eAAe,KAAK,WAAW,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG;;;;;AAMnH,MAAa,gBAA2B;CACvC,MAAM;CACN,MAAM,OAAO;EACZ,MAAM,SAAU,MAAM,QAA4C,WAAW,YAAY,YAAY;EACrG,MAAM,OAAO,EAAE,OAAO,IAAI,EAAE,WAAW;GACtC,MAAM,SAAS,KAAK,MAAM;IAAE;IAAQ;GAAQ,CAAC;GAC7C,IAAI,OAAO,SAAS,SAAS,GAC5B,MAAM,IAAI,MAAM,kBAAkB,KAAK,IAAI,eAAe,OAAO,QAAQ,GAAG;GAE7E,OAAO;IAAE,UAAU,OAAO;IAAM,QAAQ;GAAK;EAC9C,CAAC;CACF;AACD;AAEK,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"bun.mjs","names":[],"sources":["../src/bun.ts"],"sourcesContent":["import { extname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { plugin } from 'bun';\n\nimport { configSuffixes, formatProblems } from './core/index.ts';\nimport { load } from './runtime/index.ts';\n\nimport type { BunPlugin } from 'bun';\n\n// The runtime next to this module, so it resolves from config files outside the dependency tree: `.ts` in this repo, `.mjs` once built.\nconst runtime = fileURLToPath(new URL(`runtime/index${extname(import.meta.url)}`, import.meta.url));\n\nconst filter = new RegExp(`[^/\\\\\\\\](?:${configSuffixes.map((suffix) => suffix.replaceAll('.', '\\\\.')).join('|')})$`);\n\n/**\n * The tyfigo Bun plugin. Importing `tyfigo/bun` (a `bunfig.toml` `preload`) registers it for the runtime and `bun test`; pass\n * `tyfigo()` in `plugins` to use it with `Bun.build`, where a `browser` target inlines the config and a server target inlines the config files and reads `.env` files when it runs.\n */\nexport const tyfigo = (): BunPlugin => ({\n\tname: 'tyfigo',\n\tsetup(build) {\n\t\tconst config = build.config as typeof build.config | undefined;\n\t\tconst target = config?.target === 'browser' ? 'browser' : 'server';\n\t\tbuild.onLoad({ filter }, ({ path }) => {\n\t\t\tconst result = load(path, { target, runtime, bundle: config !== undefined });\n\t\t\tif (result.problems.length > 0) {\n\t\t\t\tthrow new Error(`Invalid config ${path}\\n${formatProblems(result.problems)}`);\n\t\t\t}\n\t\t\treturn { contents: result.code, loader: 'js' };\n\t\t});\n\t},\n});\n\nvoid plugin(tyfigo());\n"],"mappings":";;;;;;AAWA,MAAM,UAAU,cAAc,IAAI,IAAI,gBAAgB,QAAQ,YAAY,GAAG,KAAK,YAAY,GAAG,CAAC;AAElG,MAAM,SAAS,IAAI,OAAO,cAAc,eAAe,KAAK,WAAW,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG;;;;;AAMnH,MAAa,gBAA2B;CACvC,MAAM;CACN,MAAM,OAAO;EACZ,MAAM,SAAS,MAAM;EACrB,MAAM,SAAS,QAAQ,WAAW,YAAY,YAAY;EAC1D,MAAM,OAAO,EAAE,OAAO,IAAI,EAAE,WAAW;GACtC,MAAM,SAAS,KAAK,MAAM;IAAE;IAAQ;IAAS,QAAQ,WAAW,KAAA;GAAU,CAAC;GAC3E,IAAI,OAAO,SAAS,SAAS,GAC5B,MAAM,IAAI,MAAM,kBAAkB,KAAK,IAAI,eAAe,OAAO,QAAQ,GAAG;GAE7E,OAAO;IAAE,UAAU,OAAO;IAAM,QAAQ;GAAK;EAC9C,CAAC;CACF;AACD;AAEK,OAAO,OAAO,CAAC"}
package/dist/effect.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { d as ResolvedLayer, f as LocatedSpan, g as Span, h as Path, l as ResolveOptions, m as ProblemCode, p as Problem, r as ConfigSource, u as ResolvedConfig } from "./resolve-BeFHJeZb.mjs";
2
- import { a as LooseInput, i as LoadEnvOptions, n as ConfigSchema, o as SchemaInput, r as ConfigValidationError, s as SchemaOutput, t as ConfigIssue } from "./schema-CNquZBC8.mjs";
1
+ import { a as LocatedSpan, c as Path, i as ResolvedLayer, l as Span, n as ResolveOptions, o as Problem, r as ResolvedConfig, s as ProblemCode } from "./index-CM4xg0II.mjs";
2
+ import { i as ConfigSource } from "./resolve-BUtCDolX.mjs";
3
+ import { a as LooseInput, i as LoadEnvOptions, n as ConfigSchema, o as SchemaInput, r as ConfigValidationError, s as SchemaOutput, t as ConfigIssue } from "./schema-CkQRd2Uf.mjs";
3
4
  import { ConfigProvider, Context, Effect, Layer, Schema } from "effect";
4
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
6
  /**
package/dist/effect.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { o as resolveConfig } from "./resolve-CDWA58rz.mjs";
2
- import { n as decodeConfig, r as decodeEnv, t as ConfigValidationError } from "./schema-C31aywfc.mjs";
1
+ import { t as resolveConfig } from "./resolve-B7e2uGDa.mjs";
2
+ import { n as decodeConfig, r as decodeEnv, t as ConfigValidationError } from "./schema-C_damFGy.mjs";
3
3
  import { ConfigProvider, Context, Effect, Layer } from "effect";
4
4
  // src/effect/load.ts
5
5
  /**
@@ -53,6 +53,10 @@ interface Format {
53
53
  readonly parseScalar: (text: string) => unknown;
54
54
  }
55
55
  type LayerKind = 'base' | 'environment' | 'local' | 'environment-local';
56
+ interface LayerFile {
57
+ readonly file: string;
58
+ readonly kind: LayerKind;
59
+ }
56
60
  /**
57
61
  * A {@link Span} together with the file it is in.
58
62
  */
@@ -102,54 +106,8 @@ interface ResolvedConfig {
102
106
  readonly positions: ReadonlyMap<string, LocatedSpan>;
103
107
  readonly problems: readonly Problem[];
104
108
  }
105
- /**
106
- * The key of the non-enumerable {@link ConfigSource} on a config object exported by a generated server module.
107
- */
108
- declare const configSource: unique symbol;
109
- interface SourcePosition {
110
- readonly file: string;
111
- readonly line: number;
112
- readonly column: number;
113
- }
114
- interface ConfigSource {
115
- /**
116
- * The base config file, as an absolute path.
117
- */
118
- readonly file: string;
119
- readonly environment: string | undefined;
120
- /**
121
- * The layer files that were merged, in the order they apply.
122
- */
123
- readonly layers: readonly string[];
124
- /**
125
- * The `.env` files that were read, in the order they apply.
126
- */
127
- readonly envFiles: readonly string[];
128
- /**
129
- * Where the value at `path` was set. A path the config does not have resolves to its nearest ancestor that it does have.
130
- */
131
- readonly position: (path: Path) => SourcePosition | undefined;
132
- }
133
- declare const ConfigModuleError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
134
- readonly _tag: "ConfigModuleError";
135
- } & Readonly<A>;
136
- declare class ConfigModuleError extends ConfigModuleError_base<{
137
- readonly message: string;
138
- readonly file: string;
139
- readonly problems: readonly Problem[];
140
- }> {}
141
- interface ConfigModuleOptions {
142
- /**
143
- * The environment name that picks `app.<environment>.config.yaml` and `.env.<environment>`. Defaults to `NODE_ENV`.
144
- */
145
- readonly environment?: string | undefined;
109
+ interface LayerSource extends LayerFile {
110
+ readonly text: string;
146
111
  }
147
- declare const deepFreeze: <T>(value: T) => T;
148
- declare const getConfigSource: (value: unknown) => ConfigSource | undefined;
149
- /**
150
- * Resolves a config file with its layers, `.env` files and placeholders, and returns the deep-frozen value. This is what a
151
- * generated server module calls when it is evaluated. Throws a {@link ConfigModuleError} listing every problem.
152
- */
153
- declare const resolveConfigModule: (file: string, options?: ConfigModuleOptions) => unknown;
154
- export { configSource as a, resolveConfigModule as c, ResolvedLayer as d, LocatedSpan as f, Span as g, Path as h, SourcePosition as i, ResolveOptions as l, ProblemCode as m, ConfigModuleOptions as n, deepFreeze as o, Problem as p, ConfigSource as r, getConfigSource as s, ConfigModuleError as t, ResolvedConfig as u };
155
- //# sourceMappingURL=resolve-BeFHJeZb.d.mts.map
112
+ export { LocatedSpan as a, Path as c, ResolvedLayer as i, Span as l, ResolveOptions as n, Problem as o, ResolvedConfig as r, ProblemCode as s, LayerSource as t };
113
+ //# sourceMappingURL=index-CM4xg0II.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { d as ResolvedLayer, f as LocatedSpan, g as Span, h as Path, l as ResolveOptions, m as ProblemCode, p as Problem, r as ConfigSource, u as ResolvedConfig } from "./resolve-BeFHJeZb.mjs";
2
- import { a as LooseInput, i as LoadEnvOptions, n as ConfigSchema, o as SchemaInput, r as ConfigValidationError, s as SchemaOutput, t as ConfigIssue } from "./schema-CNquZBC8.mjs";
1
+ import { a as LocatedSpan, c as Path, i as ResolvedLayer, l as Span, n as ResolveOptions, o as Problem, r as ResolvedConfig, s as ProblemCode } from "./index-CM4xg0II.mjs";
2
+ import { i as ConfigSource } from "./resolve-BUtCDolX.mjs";
3
+ import { a as LooseInput, i as LoadEnvOptions, n as ConfigSchema, o as SchemaInput, r as ConfigValidationError, s as SchemaOutput, t as ConfigIssue } from "./schema-CkQRd2Uf.mjs";
3
4
  /**
4
5
  * Validates a config import (or any value) with a Standard Schema or an Effect Schema and returns the schema's output.
5
6
  *
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as decodeConfig, r as decodeEnv, t as ConfigValidationError } from "./schema-C31aywfc.mjs";
1
+ import { n as decodeConfig, r as decodeEnv, t as ConfigValidationError } from "./schema-C_damFGy.mjs";
2
2
  import { Effect } from "effect";
3
3
  // src/index.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { c as processEnv, d as searchDirectories, o as resolveConfig, s as envFileNames, u as isFile } from "./resolve-CDWA58rz.mjs";
1
+ import { c as searchDirectories, i as processEnv, o as findProjectRoot, r as envFileNames, s as isFile, t as resolveConfig } from "./resolve-B7e2uGDa.mjs";
2
2
  import { a as parseConfigFileName, c as pathKey, d as problemAt, i as configSuffixes, l as fileProblem, n as isPlainObject, o as SourceIndex, s as formatPath, t as hasPlaceholder, u as formatProblems } from "./placeholders-MqW2KO9Z.mjs";
3
3
  import { Effect } from "effect";
4
- import { basename, dirname, join, resolve } from "node:path";
4
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
5
5
  // src/runtime/load.ts
6
6
  const browserLayers = ["base", "environment"];
7
7
  const watchFilesOf = Effect.fn("watchFilesOf")(function* (file, environment, target) {
@@ -15,22 +15,25 @@ const watchFilesOf = Effect.fn("watchFilesOf")(function* (file, environment, tar
15
15
  for (const fileName of [...locals, ...envFileNames(environment)]) for (const directory of directories) files.push(join(directory, fileName));
16
16
  return files;
17
17
  });
18
- const literal = (value, indent) => {
18
+ /**
19
+ * A JavaScript expression that evaluates to a deep-frozen copy of a config value.
20
+ */
21
+ const valueLiteral = (value, indent = "") => {
19
22
  if (value === void 0) return "undefined";
20
23
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : String(value);
21
24
  if (typeof value === "bigint") return `${value}n`;
22
- if (value instanceof Date) return `new Date(${literal(value.getTime(), indent)})`;
25
+ if (value instanceof Date) return `new Date(${valueLiteral(value.getTime(), indent)})`;
23
26
  const inner = `${indent}\t`;
24
27
  if (Array.isArray(value)) {
25
28
  if (value.length === 0) return "Object.freeze([])";
26
- return `Object.freeze([\n${value.map((item) => `${inner}${literal(item, inner)},\n`).join("")}${indent}])`;
29
+ return `Object.freeze([\n${value.map((item) => `${inner}${valueLiteral(item, inner)},\n`).join("")}${indent}])`;
27
30
  }
28
31
  if (isPlainObject(value)) {
29
32
  const entries = Object.entries(value);
30
33
  if (entries.length === 0) return "Object.freeze({})";
31
34
  return `Object.freeze({\n${entries.map(([key, item]) => {
32
35
  const name = key === "__proto__" ? `[${JSON.stringify(key)}]` : JSON.stringify(key);
33
- return `${inner}${name}: ${literal(item, inner)},\n`;
36
+ return `${inner}${name}: ${valueLiteral(item, inner)},\n`;
34
37
  }).join("")}${indent}})`;
35
38
  }
36
39
  return JSON.stringify(value);
@@ -78,22 +81,44 @@ const browserModule = Effect.fn("browserModule")(function* (file, options) {
78
81
  if (parsed?.value !== void 0) problems.push(...placeholderProblems(layer.file, layer.text, parsed.value, layer.positions));
79
82
  }
80
83
  return {
81
- code: problems.length > 0 ? failingCode(result.file, problems) : `export default ${literal(result.value, "")};\n`,
84
+ code: problems.length > 0 ? failingCode(result.file, problems) : `export default ${valueLiteral(result.value, "")};\n`,
82
85
  watchFiles: yield* watchFilesOf(result.file, environment, "browser"),
83
86
  problems
84
87
  };
85
88
  });
89
+ const bundledServerModule = Effect.fn("bundledServerModule")(function* (file, options) {
90
+ const environment = options.environment ?? (processEnv().NODE_ENV || void 0);
91
+ const result = yield* resolveConfig(file, { environment });
92
+ const problems = result.problems.filter((problem) => problem.code !== "missing-variable");
93
+ const root = (yield* findProjectRoot(dirname(result.file))) ?? dirname(result.file);
94
+ const name = (path) => relative(root, path).split(sep).join("/");
95
+ const bundle = {
96
+ file: name(result.file),
97
+ environment,
98
+ layers: result.layers.map((layer) => ({
99
+ file: name(layer.file),
100
+ kind: layer.kind,
101
+ text: layer.text
102
+ }))
103
+ };
104
+ return {
105
+ code: problems.length > 0 ? failingCode(result.file, problems) : `import { resolveBundledConfigModule } from ${JSON.stringify(options.runtime ?? "tyfigo/runtime")};\n\nexport default resolveBundledConfigModule(${JSON.stringify(bundle)});\n`,
106
+ watchFiles: yield* watchFilesOf(result.file, environment, "server"),
107
+ problems
108
+ };
109
+ });
86
110
  /**
87
111
  * Generates the JavaScript module for a config file import. Loaders fail the import or build when `problems` is not empty.
88
112
  */
89
113
  const loadModule = Effect.fn("loadModule")(function* (path, options) {
90
114
  const file = resolve(path);
91
- return options.target === "browser" ? yield* browserModule(file, options) : yield* serverModule(file, options);
115
+ if (options.target === "browser") return yield* browserModule(file, options);
116
+ return options.bundle ? yield* bundledServerModule(file, options) : yield* serverModule(file, options);
92
117
  });
93
118
  /**
94
119
  * {@link loadModule} for synchronous callers such as Node `registerHooks` load hooks.
95
120
  */
96
121
  const load = (path, options) => Effect.runSync(loadModule(path, options));
97
- export { loadModule as n, load as t };
122
+ export { loadModule as n, valueLiteral as r, load as t };
98
123
 
99
- //# sourceMappingURL=runtime-BuQk1xsn.mjs.map
124
+ //# sourceMappingURL=load-BqGJgpfo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-BqGJgpfo.mjs","names":[],"sources":["../src/runtime/load.ts"],"sourcesContent":["import { basename, dirname, join, relative, resolve, sep } from 'node:path';\n\nimport { Effect } from 'effect';\n\nimport { findProjectRoot, isFile, searchDirectories } from '../core/files.ts';\nimport {\n\tconfigSuffixes,\n\tenvFileNames,\n\tfileProblem,\n\tformatPath,\n\tformatProblems,\n\thasPlaceholder,\n\tisPlainObject,\n\tparseConfigFileName,\n\tpathKey,\n\tproblemAt,\n\tprocessEnv,\n\tresolveConfig,\n\tSourceIndex,\n} from '../core/index.ts';\n\nimport type { Path, PositionMap, Problem } from '../core/index.ts';\nimport type { BundledConfig } from './resolve.ts';\n\nexport type LoadTarget = 'server' | 'browser';\n\nexport interface LoadOptions {\n\t/**\n\t * `server` resolves the config when the module runs. `browser` inlines the base and environment files at build time and\n\t * reports every placeholder as a problem.\n\t */\n\treadonly target: LoadTarget;\n\t/**\n\t * The environment name, such as the bundler's mode. Defaults to `NODE_ENV`, read when the server module runs and when\n\t * `load` runs for the browser.\n\t */\n\treadonly environment?: string | undefined;\n\t/**\n\t * The specifier the server module imports the runtime from. Defaults to `tyfigo/runtime`.\n\t */\n\treadonly runtime?: string | undefined;\n\t/**\n\t * For `server`: inline the text of the layer files that exist at build time, and read `.env` files and environment variables\n\t * from `process.cwd()` when the module runs, so a bundle does not depend on the paths of the machine that built it.\n\t */\n\treadonly bundle?: boolean | undefined;\n}\n\nexport interface LoadResult {\n\t/**\n\t * The JavaScript module, with the config as its default export.\n\t */\n\treadonly code: string;\n\t/**\n\t * Every file whose creation, change or removal changes the module, whether or not it exists now.\n\t */\n\treadonly watchFiles: readonly string[];\n\treadonly problems: readonly Problem[];\n}\n\nconst browserLayers = ['base', 'environment'] as const;\n\nconst watchFilesOf = Effect.fn('watchFilesOf')(function* (\n\tfile: string,\n\tenvironment: string | undefined,\n\ttarget: LoadTarget,\n) {\n\tconst name = parseConfigFileName(basename(file));\n\tif (!name) return [file];\n\n\tconst files = [file];\n\tif (environment) files.push(join(dirname(file), `${name.stem}.${environment}${name.suffix}`));\n\tif (target === 'browser') return files;\n\n\tconst directories = yield* searchDirectories(file);\n\tconst locals = environment\n\t\t? [`${name.stem}.local${name.suffix}`, `${name.stem}.${environment}.local${name.suffix}`]\n\t\t: [`${name.stem}.local${name.suffix}`];\n\tfor (const fileName of [...locals, ...envFileNames(environment)]) {\n\t\tfor (const directory of directories) files.push(join(directory, fileName));\n\t}\n\treturn files;\n});\n\n/**\n * A JavaScript expression that evaluates to a deep-frozen copy of a config value.\n */\nexport const valueLiteral = (value: unknown, indent = ''): string => {\n\tif (value === undefined) return 'undefined';\n\tif (typeof value === 'number') return Object.is(value, -0) ? '-0' : String(value);\n\tif (typeof value === 'bigint') return `${value}n`;\n\tif (value instanceof Date) return `new Date(${valueLiteral(value.getTime(), indent)})`;\n\tconst inner = `${indent}\\t`;\n\tif (Array.isArray(value)) {\n\t\tif (value.length === 0) return 'Object.freeze([])';\n\t\tconst items = value.map((item) => `${inner}${valueLiteral(item, inner)},\\n`);\n\t\treturn `Object.freeze([\\n${items.join('')}${indent}])`;\n\t}\n\tif (isPlainObject(value)) {\n\t\tconst entries = Object.entries(value);\n\t\tif (entries.length === 0) return 'Object.freeze({})';\n\t\tconst properties = entries.map(([key, item]) => {\n\t\t\tconst name = key === '__proto__' ? `[${JSON.stringify(key)}]` : JSON.stringify(key);\n\t\t\treturn `${inner}${name}: ${valueLiteral(item, inner)},\\n`;\n\t\t});\n\t\treturn `Object.freeze({\\n${properties.join('')}${indent}})`;\n\t}\n\treturn JSON.stringify(value);\n};\n\nconst hasUnescapedPlaceholder = (text: string) => hasPlaceholder(text.replaceAll('$${', ''));\n\nconst placeholderProblems = (file: string, text: string, value: unknown, positions: PositionMap) => {\n\tconst source = new SourceIndex(text);\n\tconst problems: Problem[] = [];\n\tconst visit = (item: unknown, path: Path) => {\n\t\tif (typeof item === 'string') {\n\t\t\tif (!hasUnescapedPlaceholder(item)) return;\n\t\t\tconst span = positions.get(pathKey(path));\n\t\t\tproblems.push(\n\t\t\t\tproblemAt(\n\t\t\t\t\tsource,\n\t\t\t\t\tfile,\n\t\t\t\t\tspan?.valueStart ?? 0,\n\t\t\t\t\tspan?.valueLength ?? 0,\n\t\t\t\t\t'browser-placeholder',\n\t\t\t\t\t`'${formatPath(path) || '(root)'}' uses an environment placeholder, which browser builds cannot read`,\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (Array.isArray(item)) for (const [index, child] of item.entries()) visit(child, [...path, index]);\n\t\telse if (isPlainObject(item)) for (const [key, child] of Object.entries(item)) visit(child, [...path, key]);\n\t};\n\tvisit(value, []);\n\treturn problems;\n};\n\nconst failingCode = (file: string, problems: readonly Problem[]) =>\n\t`throw new Error(${JSON.stringify(`Invalid config ${file}\\n${formatProblems(problems)}`)});\\n\\nexport default undefined;\\n`;\n\nconst serverModule = Effect.fn('serverModule')(function* (file: string, options: LoadOptions) {\n\tconst problems: Problem[] = [];\n\tif (!parseConfigFileName(basename(file))) {\n\t\tproblems.push(\n\t\t\tfileProblem(\n\t\t\t\tfile,\n\t\t\t\t'unsupported-file',\n\t\t\t\t`${basename(file)} is not a config file; expected a name ending in ${configSuffixes.join(', ')}`,\n\t\t\t),\n\t\t);\n\t} else if (!(yield* isFile(file))) problems.push(fileProblem(file, 'file-not-found', `Cannot find ${file}`));\n\n\tconst settings =\n\t\toptions.environment === undefined ? '' : `, { environment: ${JSON.stringify(options.environment)} }`;\n\tconst code = `import { resolveConfigModule } from ${JSON.stringify(options.runtime ?? 'tyfigo/runtime')};\\n\\nexport default resolveConfigModule(${JSON.stringify(file)}${settings});\\n`;\n\tconst environment = options.environment ?? (processEnv().NODE_ENV || undefined);\n\treturn { code, watchFiles: yield* watchFilesOf(file, environment, 'server'), problems } satisfies LoadResult;\n});\n\nconst browserModule = Effect.fn('browserModule')(function* (file: string, options: LoadOptions) {\n\tconst environment = options.environment ?? (processEnv().NODE_ENV || undefined);\n\tconst result = yield* resolveConfig(file, { environment, env: {}, layers: browserLayers });\n\tconst files = new Set([result.file, ...result.layers.map((layer) => layer.file)]);\n\tconst problems = result.problems.filter(\n\t\t(problem) =>\n\t\t\tfiles.has(problem.file) && problem.code !== 'missing-variable' && problem.code !== 'invalid-placeholder',\n\t);\n\tfor (const layer of result.layers) {\n\t\tconst parsed = result.format?.parse(layer.text, layer.file);\n\t\tif (parsed?.value !== undefined) {\n\t\t\tproblems.push(...placeholderProblems(layer.file, layer.text, parsed.value, layer.positions));\n\t\t}\n\t}\n\n\tconst code =\n\t\tproblems.length > 0\n\t\t\t? failingCode(result.file, problems)\n\t\t\t: `export default ${valueLiteral(result.value, '')};\\n`;\n\treturn {\n\t\tcode,\n\t\twatchFiles: yield* watchFilesOf(result.file, environment, 'browser'),\n\t\tproblems,\n\t} satisfies LoadResult;\n});\n\nconst bundledServerModule = Effect.fn('bundledServerModule')(function* (file: string, options: LoadOptions) {\n\tconst environment = options.environment ?? (processEnv().NODE_ENV || undefined);\n\tconst result = yield* resolveConfig(file, { environment });\n\tconst problems = result.problems.filter((problem) => problem.code !== 'missing-variable');\n\tconst root = (yield* findProjectRoot(dirname(result.file))) ?? dirname(result.file);\n\tconst name = (path: string) => relative(root, path).split(sep).join('/');\n\tconst bundle: BundledConfig = {\n\t\tfile: name(result.file),\n\t\tenvironment,\n\t\tlayers: result.layers.map((layer) => ({ file: name(layer.file), kind: layer.kind, text: layer.text })),\n\t};\n\n\tconst code =\n\t\tproblems.length > 0\n\t\t\t? failingCode(result.file, problems)\n\t\t\t: `import { resolveBundledConfigModule } from ${JSON.stringify(options.runtime ?? 'tyfigo/runtime')};\\n\\nexport default resolveBundledConfigModule(${JSON.stringify(bundle)});\\n`;\n\treturn {\n\t\tcode,\n\t\twatchFiles: yield* watchFilesOf(result.file, environment, 'server'),\n\t\tproblems,\n\t} satisfies LoadResult;\n});\n\n/**\n * Generates the JavaScript module for a config file import. Loaders fail the import or build when `problems` is not empty.\n */\nexport const loadModule = Effect.fn('loadModule')(function* (path: string, options: LoadOptions) {\n\tconst file = resolve(path);\n\tif (options.target === 'browser') return yield* browserModule(file, options);\n\treturn options.bundle ? yield* bundledServerModule(file, options) : yield* serverModule(file, options);\n});\n\n/**\n * {@link loadModule} for synchronous callers such as Node `registerHooks` load hooks.\n */\nexport const load = (path: string, options: LoadOptions): LoadResult => Effect.runSync(loadModule(path, options));\n"],"mappings":";;;;;AA4DA,MAAM,gBAAgB,CAAC,QAAQ,aAAa;AAE5C,MAAM,eAAe,OAAO,GAAG,cAAc,CAAC,CAAC,WAC9C,MACA,aACA,QACC;C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AAoB,MAAM,OAAO,IAAI,OAAO,aAAa,MAAM,OAAO;AACtG,CAAC;;;;AAKD,MAAa,QAAQ,MAAc,YAAqC,OAAO,QAAQ,WAAW,MAAM,OAAO,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { o as Problem } from "./index-CM4xg0II.mjs";
2
+ import { Effect } from "effect";
3
+ type LoadTarget = 'server' | 'browser';
4
+ interface LoadOptions {
5
+ /**
6
+ * `server` resolves the config when the module runs. `browser` inlines the base and environment files at build time and
7
+ * reports every placeholder as a problem.
8
+ */
9
+ readonly target: LoadTarget;
10
+ /**
11
+ * The environment name, such as the bundler's mode. Defaults to `NODE_ENV`, read when the server module runs and when
12
+ * `load` runs for the browser.
13
+ */
14
+ readonly environment?: string | undefined;
15
+ /**
16
+ * The specifier the server module imports the runtime from. Defaults to `tyfigo/runtime`.
17
+ */
18
+ readonly runtime?: string | undefined;
19
+ /**
20
+ * For `server`: inline the text of the layer files that exist at build time, and read `.env` files and environment variables
21
+ * from `process.cwd()` when the module runs, so a bundle does not depend on the paths of the machine that built it.
22
+ */
23
+ readonly bundle?: boolean | undefined;
24
+ }
25
+ interface LoadResult {
26
+ /**
27
+ * The JavaScript module, with the config as its default export.
28
+ */
29
+ readonly code: string;
30
+ /**
31
+ * Every file whose creation, change or removal changes the module, whether or not it exists now.
32
+ */
33
+ readonly watchFiles: readonly string[];
34
+ readonly problems: readonly Problem[];
35
+ }
36
+ /**
37
+ * A JavaScript expression that evaluates to a deep-frozen copy of a config value.
38
+ */
39
+ declare const valueLiteral: (value: unknown, indent?: string) => string;
40
+ /**
41
+ * Generates the JavaScript module for a config file import. Loaders fail the import or build when `problems` is not empty.
42
+ */
43
+ declare const loadModule: (path: string, options: LoadOptions) => Effect.Effect<{
44
+ code: string;
45
+ watchFiles: string[];
46
+ problems: Problem[];
47
+ }, never, never>;
48
+ /**
49
+ * {@link loadModule} for synchronous callers such as Node `registerHooks` load hooks.
50
+ */
51
+ declare const load: (path: string, options: LoadOptions) => LoadResult;
52
+ export { loadModule as a, load as i, LoadResult as n, valueLiteral as o, LoadTarget as r, LoadOptions as t };
53
+ //# sourceMappingURL=load-CKIE0mVT.d.mts.map
@@ -0,0 +1,5 @@
1
+ import { t as TyfigoPluginOptions } from "../shared-CLa0Be_8.mjs";
2
+ import "../unplugin-ce5g3K3a.mjs";
3
+ declare const _default: (options?: TyfigoPluginOptions | undefined) => import("esbuild").Plugin;
4
+ export { type TyfigoPluginOptions, _default as default };
5
+ //# sourceMappingURL=esbuild.d.mts.map
@@ -0,0 +1,6 @@
1
+ import { t as tyfigo } from "../unplugin-DXVarwkX.mjs";
2
+ // src/plugins/esbuild.ts
3
+ var esbuild_default = tyfigo.esbuild;
4
+ export { esbuild_default as default };
5
+
6
+ //# sourceMappingURL=esbuild.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.mjs","names":[],"sources":["../../src/plugins/esbuild.ts"],"sourcesContent":["import { tyfigo } from './unplugin.ts';\n\nexport type { TyfigoPluginOptions } from './unplugin.ts';\n\nexport default tyfigo.esbuild;\n"],"mappings":";;AAIA,IAAA,kBAAe,OAAO"}
@@ -0,0 +1,10 @@
1
+ import { t as TyfigoPluginOptions } from "../shared-CLa0Be_8.mjs";
2
+ import { SyncTransformer } from "@jest/transform";
3
+ export type TyfigoJestOptions = Omit<TyfigoPluginOptions, 'target'>;
4
+ /**
5
+ * A Jest transformer for config imports. Native ESM tests (`NODE_OPTIONS=--experimental-vm-modules`) get the server module,
6
+ * which resolves the config when it is imported. CommonJS tests get the config resolved when Jest transforms the file.
7
+ */
8
+ declare const transformer: SyncTransformer<TyfigoJestOptions | undefined>;
9
+ export { transformer as default };
10
+ //# sourceMappingURL=jest.d.mts.map
@@ -0,0 +1,29 @@
1
+ import { u as formatProblems } from "../placeholders-MqW2KO9Z.mjs";
2
+ import { n as resolveConfigSync } from "../sync-DUNHC9W6.mjs";
3
+ import { r as valueLiteral } from "../load-BqGJgpfo.mjs";
4
+ import { r as loadConfigImport } from "../shared-BuRtKsWB.mjs";
5
+ import { createHash } from "node:crypto";
6
+ // src/plugins/jest.ts
7
+ const generate = (file, options) => {
8
+ const config = options.transformerConfig ?? {};
9
+ if (options.supportsStaticESM) return loadConfigImport(file, {
10
+ target: "server",
11
+ environment: config.environment,
12
+ runtime: config.runtime
13
+ }).code;
14
+ const result = resolveConfigSync(file, { environment: config.environment });
15
+ if (result.problems.length > 0) throw new Error(`Invalid config ${result.file}\n${formatProblems(result.problems)}`);
16
+ return `module.exports = { __esModule: true, default: ${valueLiteral(result.value)} };\n`;
17
+ };
18
+ /**
19
+ * A Jest transformer for config imports. Native ESM tests (`NODE_OPTIONS=--experimental-vm-modules`) get the server module,
20
+ * which resolves the config when it is imported. CommonJS tests get the config resolved when Jest transforms the file.
21
+ */
22
+ const transformer = {
23
+ canInstrument: false,
24
+ getCacheKey: (_source, file, options) => createHash("sha256").update(file).update(String(options.supportsStaticESM)).update(generate(file, options)).digest("hex"),
25
+ process: (_source, file, options) => ({ code: generate(file, options) })
26
+ };
27
+ export { transformer as default };
28
+
29
+ //# sourceMappingURL=jest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.mjs","names":[],"sources":["../../src/plugins/jest.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { loadConfigImport } from './shared.ts';\n\nimport { formatProblems, resolveConfigSync } from '../core/index.ts';\nimport { valueLiteral } from '../runtime/load.ts';\n\nimport type { TyfigoPluginOptions } from './shared.ts';\nimport type { SyncTransformer, TransformOptions } from '@jest/transform';\n\nexport type TyfigoJestOptions = Omit<TyfigoPluginOptions, 'target'>;\n\nconst generate = (file: string, options: TransformOptions<TyfigoJestOptions | undefined>) => {\n\tconst config = options.transformerConfig ?? {};\n\tif (options.supportsStaticESM) {\n\t\treturn loadConfigImport(file, {\n\t\t\ttarget: 'server',\n\t\t\tenvironment: config.environment,\n\t\t\truntime: config.runtime,\n\t\t}).code;\n\t}\n\n\tconst result = resolveConfigSync(file, { environment: config.environment });\n\tif (result.problems.length > 0) {\n\t\tthrow new Error(`Invalid config ${result.file}\\n${formatProblems(result.problems)}`);\n\t}\n\treturn `module.exports = { __esModule: true, default: ${valueLiteral(result.value)} };\\n`;\n};\n\n/**\n * A Jest transformer for config imports. Native ESM tests (`NODE_OPTIONS=--experimental-vm-modules`) get the server module,\n * which resolves the config when it is imported. CommonJS tests get the config resolved when Jest transforms the file.\n */\nconst transformer: SyncTransformer<TyfigoJestOptions | undefined> = {\n\tcanInstrument: false,\n\tgetCacheKey: (_source, file, options) =>\n\t\tcreateHash('sha256')\n\t\t\t.update(file)\n\t\t\t.update(String(options.supportsStaticESM))\n\t\t\t.update(generate(file, options))\n\t\t\t.digest('hex'),\n\tprocess: (_source, file, options) => ({ code: generate(file, options) }),\n};\n\nexport default transformer;\n"],"mappings":";;;;;;AAYA,MAAM,YAAY,MAAc,YAA6D;CAC5F,MAAM,SAAS,QAAQ,qBAAqB,CAAC;CAC7C,IAAI,QAAQ,mBACX,OAAO,iBAAiB,MAAM;EAC7B,QAAQ;EACR,aAAa,OAAO;EACpB,SAAS,OAAO;CACjB,CAAC,CAAC,CAAC;CAGJ,MAAM,SAAS,kBAAkB,MAAM,EAAE,aAAa,OAAO,YAAY,CAAC;CAC1E,IAAI,OAAO,SAAS,SAAS,GAC5B,MAAM,IAAI,MAAM,kBAAkB,OAAO,KAAK,IAAI,eAAe,OAAO,QAAQ,GAAG;CAEpF,OAAO,iDAAiD,aAAa,OAAO,KAAK,EAAE;AACpF;;;;;AAMA,MAAM,cAA8D;CACnE,eAAe;CACf,cAAc,SAAS,MAAM,YAC5B,WAAW,QAAQ,CAAC,CAClB,OAAO,IAAI,CAAC,CACZ,OAAO,OAAO,QAAQ,iBAAiB,CAAC,CAAC,CACzC,OAAO,SAAS,MAAM,OAAO,CAAC,CAAC,CAC/B,OAAO,KAAK;CACf,UAAU,SAAS,MAAM,aAAa,EAAE,MAAM,SAAS,MAAM,OAAO,EAAE;AACvE"}
@@ -0,0 +1,15 @@
1
+ import { n as WebpackLikePlatform, t as TyfigoPluginOptions } from "../shared-CLa0Be_8.mjs";
2
+ export interface TyfigoLoaderContext {
3
+ readonly resourcePath: string;
4
+ readonly getOptions: () => TyfigoPluginOptions;
5
+ readonly addDependency: (file: string) => void;
6
+ readonly _compiler?: {
7
+ readonly platform: WebpackLikePlatform;
8
+ } | undefined;
9
+ }
10
+ /**
11
+ * A webpack loader for config files, for webpack-compatible loader runners such as Turbopack's. Without a `target` option it
12
+ * detects the target from the compiler's platform when the runner exposes one, and falls back to `browser`.
13
+ */
14
+ export default function tyfigoLoader(this: TyfigoLoaderContext): string;
15
+ //# sourceMappingURL=loader.d.mts.map
@@ -0,0 +1,21 @@
1
+ import { n as isServerPlatform, r as loadConfigImport } from "../shared-BuRtKsWB.mjs";
2
+ // src/plugins/loader.ts
3
+ /**
4
+ * A webpack loader for config files, for webpack-compatible loader runners such as Turbopack's. Without a `target` option it
5
+ * detects the target from the compiler's platform when the runner exposes one, and falls back to `browser`.
6
+ */
7
+ function tyfigoLoader() {
8
+ const options = this.getOptions();
9
+ const target = options.target ?? (this._compiler && isServerPlatform(this._compiler.platform) ? "server" : "browser");
10
+ const result = loadConfigImport(this.resourcePath, {
11
+ target,
12
+ bundle: true,
13
+ environment: options.environment,
14
+ runtime: options.runtime
15
+ });
16
+ for (const file of result.watchFiles) this.addDependency(file);
17
+ return result.code;
18
+ }
19
+ export { tyfigoLoader as default };
20
+
21
+ //# sourceMappingURL=loader.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.mjs","names":[],"sources":["../../src/plugins/loader.ts"],"sourcesContent":["import { isServerPlatform, loadConfigImport } from './shared.ts';\n\nimport type { TyfigoPluginOptions, WebpackLikePlatform } from './shared.ts';\n\nexport interface TyfigoLoaderContext {\n\treadonly resourcePath: string;\n\treadonly getOptions: () => TyfigoPluginOptions;\n\treadonly addDependency: (file: string) => void;\n\treadonly _compiler?: { readonly platform: WebpackLikePlatform } | undefined;\n}\n\n/**\n * A webpack loader for config files, for webpack-compatible loader runners such as Turbopack's. Without a `target` option it\n * detects the target from the compiler's platform when the runner exposes one, and falls back to `browser`.\n */\nexport default function tyfigoLoader(this: TyfigoLoaderContext): string {\n\tconst options = this.getOptions();\n\tconst target =\n\t\toptions.target ?? (this._compiler && isServerPlatform(this._compiler.platform) ? 'server' : 'browser');\n\tconst result = loadConfigImport(this.resourcePath, {\n\t\ttarget,\n\t\tbundle: true,\n\t\tenvironment: options.environment,\n\t\truntime: options.runtime,\n\t});\n\tfor (const file of result.watchFiles) this.addDependency(file);\n\treturn result.code;\n}\n"],"mappings":";;;;;;AAeA,SAAwB,eAAgD;CACvE,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,SACL,QAAQ,WAAW,KAAK,aAAa,iBAAiB,KAAK,UAAU,QAAQ,IAAI,WAAW;CAC7F,MAAM,SAAS,iBAAiB,KAAK,cAAc;EAClD;EACA,QAAQ;EACR,aAAa,QAAQ;EACrB,SAAS,QAAQ;CAClB,CAAC;CACD,KAAK,MAAM,QAAQ,OAAO,YAAY,KAAK,cAAc,IAAI;CAC7D,OAAO,OAAO;AACf"}
@@ -0,0 +1,21 @@
1
+ import { t as TyfigoPluginOptions } from "../shared-CLa0Be_8.mjs";
2
+ import { NextConfig } from "next";
3
+ export interface WithTyfigoOptions extends Omit<TyfigoPluginOptions, 'target'> {
4
+ /**
5
+ * `next build` type-checks without `--runExternalCode`, so TypeScript cannot type config imports. When this is on, Next's
6
+ * own check is turned off and `tsc --noEmit --runExternalCode` runs after the production compile instead. Defaults to on
7
+ * unless `typescript.ignoreBuildErrors` is set.
8
+ */
9
+ readonly typeCheck?: boolean | undefined;
10
+ }
11
+ /**
12
+ * Runs `tsc --noEmit --runExternalCode` for the project's tsconfig, and rejects when it reports errors. Resolves without
13
+ * checking when the tsconfig does not exist.
14
+ */
15
+ export declare const typeCheck: (projectDir: string, tsconfigPath?: string) => Promise<void>;
16
+ /**
17
+ * Adds tyfigo to a Next.js config: a webpack rule and Turbopack rules for config imports, with the browser rule for client and
18
+ * Edge code, and a type check that can read config imports.
19
+ */
20
+ export declare const withTyfigo: (nextConfig?: NextConfig, options?: WithTyfigoOptions) => NextConfig;
21
+ //# sourceMappingURL=next.d.mts.map
@@ -0,0 +1,121 @@
1
+ import { i as configSuffixes } from "../placeholders-MqW2KO9Z.mjs";
2
+ import { t as configFilePattern } from "../shared-BuRtKsWB.mjs";
3
+ import { createRequire } from "node:module";
4
+ import { dirname, extname, join, resolve } from "node:path";
5
+ import process from "node:process";
6
+ import { existsSync } from "node:fs";
7
+ import { fileURLToPath } from "node:url";
8
+ import { spawn } from "node:child_process";
9
+ import { once } from "node:events";
10
+ // src/plugins/turbopack.ts
11
+ const loaderPath = fileURLToPath(new URL(`loader${extname(import.meta.url)}`, import.meta.url));
12
+ const loaderOptions = (options, target) => ({
13
+ target,
14
+ ...options.environment === void 0 ? {} : { environment: options.environment },
15
+ ...options.runtime === void 0 ? {} : { runtime: options.runtime }
16
+ });
17
+ const browser = { any: ["browser", "edge-light"] };
18
+ /**
19
+ * `turbopack.rules` that load config files with the tyfigo loader: client and Edge code gets the browser module, Node.js
20
+ * server code the bundled server module.
21
+ */
22
+ const turbopackRules = (options = {}) => Object.fromEntries(configSuffixes.map((suffix) => [`*${suffix}`, [{
23
+ condition: browser,
24
+ loaders: [{
25
+ loader: loaderPath,
26
+ options: loaderOptions(options, "browser")
27
+ }],
28
+ as: "*.js"
29
+ }, {
30
+ condition: { not: browser },
31
+ loaders: [{
32
+ loader: loaderPath,
33
+ options: loaderOptions(options, "server")
34
+ }],
35
+ as: "*.js"
36
+ }]]));
37
+ // src/plugins/next.ts
38
+ const tscPath = (projectDir) => {
39
+ const require = createRequire(join(projectDir, "package.json"));
40
+ const manifest = require.resolve("typescript/package.json");
41
+ const { bin } = require(manifest);
42
+ return resolve(dirname(manifest), bin.tsc ?? "bin/tsc");
43
+ };
44
+ /**
45
+ * Runs `tsc --noEmit --runExternalCode` for the project's tsconfig, and rejects when it reports errors. Resolves without
46
+ * checking when the tsconfig does not exist.
47
+ */
48
+ const typeCheck = async (projectDir, tsconfigPath = "tsconfig.json") => {
49
+ const project = resolve(projectDir, tsconfigPath);
50
+ if (!existsSync(project)) return;
51
+ const tsc = spawn(process.execPath, [
52
+ tscPath(projectDir),
53
+ "--noEmit",
54
+ "--runExternalCode",
55
+ "--project",
56
+ project
57
+ ], {
58
+ cwd: projectDir,
59
+ stdio: "inherit"
60
+ });
61
+ const [code] = await once(tsc, "exit");
62
+ if (code !== 0) throw new Error(`Type check failed: tsc --noEmit --runExternalCode --project ${project}`);
63
+ };
64
+ /**
65
+ * Adds tyfigo to a Next.js config: a webpack rule and Turbopack rules for config imports, with the browser rule for client and
66
+ * Edge code, and a type check that can read config imports.
67
+ */
68
+ const withTyfigo = (nextConfig = {}, options = {}) => {
69
+ const { typeCheck: check = !nextConfig.typescript?.ignoreBuildErrors, ...loader } = options;
70
+ const rule = (target) => ({
71
+ test: configFilePattern,
72
+ type: "javascript/auto",
73
+ use: [{
74
+ loader: loaderPath,
75
+ options: loaderOptions(loader, target)
76
+ }]
77
+ });
78
+ const config = {
79
+ ...nextConfig,
80
+ experimental: {
81
+ useTypeScriptCli: true,
82
+ ...nextConfig.experimental
83
+ },
84
+ turbopack: {
85
+ ...nextConfig.turbopack,
86
+ rules: {
87
+ ...turbopackRules(loader),
88
+ ...nextConfig.turbopack?.rules
89
+ }
90
+ },
91
+ webpack: (webpackConfig, context) => {
92
+ if (!context.isServer || context.nextRuntime === "edge") webpackConfig.module.rules.push(rule("browser"));
93
+ else webpackConfig.module.rules.push({
94
+ ...rule("browser"),
95
+ issuerLayer: "ssr"
96
+ }, {
97
+ ...rule("server"),
98
+ issuerLayer: { not: "ssr" }
99
+ });
100
+ return nextConfig.webpack ? nextConfig.webpack(webpackConfig, context) : webpackConfig;
101
+ }
102
+ };
103
+ if (!check) return config;
104
+ return {
105
+ ...config,
106
+ typescript: {
107
+ ...nextConfig.typescript,
108
+ ignoreBuildErrors: true
109
+ },
110
+ compiler: {
111
+ ...nextConfig.compiler,
112
+ runAfterProductionCompile: async (metadata) => {
113
+ await nextConfig.compiler?.runAfterProductionCompile?.(metadata);
114
+ await typeCheck(metadata.projectDir, nextConfig.typescript?.tsconfigPath);
115
+ }
116
+ }
117
+ };
118
+ };
119
+ export { typeCheck, withTyfigo };
120
+
121
+ //# sourceMappingURL=next.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.mjs","names":[],"sources":["../../src/plugins/turbopack.ts","../../src/plugins/next.ts"],"sourcesContent":["import { extname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { configSuffixes } from '../core/index.ts';\n\nimport type { LoadTarget } from '../runtime/load.ts';\nimport type { TyfigoPluginOptions } from './shared.ts';\nimport type { TurbopackRuleCondition, TurbopackRuleConfigCollection } from 'next/dist/server/config-shared.js';\n\n// The loader sits next to this module: `loader.mjs` in the package, `loader.ts` when this runs from source.\nexport const loaderPath = fileURLToPath(new URL(`loader${extname(import.meta.url)}`, import.meta.url));\n\nexport const loaderOptions = (options: Omit<TyfigoPluginOptions, 'target'>, target: LoadTarget) => ({\n\ttarget,\n\t...(options.environment === undefined ? {} : { environment: options.environment }),\n\t...(options.runtime === undefined ? {} : { runtime: options.runtime }),\n});\n\nconst browser: TurbopackRuleCondition = { any: ['browser', 'edge-light'] };\n\n/**\n * `turbopack.rules` that load config files with the tyfigo loader: client and Edge code gets the browser module, Node.js\n * server code the bundled server module.\n */\nexport const turbopackRules = (\n\toptions: Omit<TyfigoPluginOptions, 'target'> = {},\n): Record<string, TurbopackRuleConfigCollection> =>\n\tObject.fromEntries(\n\t\tconfigSuffixes.map((suffix) => [\n\t\t\t`*${suffix}`,\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcondition: browser,\n\t\t\t\t\tloaders: [{ loader: loaderPath, options: loaderOptions(options, 'browser') }],\n\t\t\t\t\tas: '*.js',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcondition: { not: browser },\n\t\t\t\t\tloaders: [{ loader: loaderPath, options: loaderOptions(options, 'server') }],\n\t\t\t\t\tas: '*.js',\n\t\t\t\t},\n\t\t\t],\n\t\t]),\n\t);\n","import { spawn } from 'node:child_process';\nimport { once } from 'node:events';\nimport { existsSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\nimport process from 'node:process';\n\nimport { configFilePattern } from './shared.ts';\nimport { loaderOptions, loaderPath, turbopackRules } from './turbopack.ts';\n\nimport type { TyfigoPluginOptions } from './shared.ts';\nimport type { NextConfig } from 'next';\n\nexport interface WithTyfigoOptions extends Omit<TyfigoPluginOptions, 'target'> {\n\t/**\n\t * `next build` type-checks without `--runExternalCode`, so TypeScript cannot type config imports. When this is on, Next's\n\t * own check is turned off and `tsc --noEmit --runExternalCode` runs after the production compile instead. Defaults to on\n\t * unless `typescript.ignoreBuildErrors` is set.\n\t */\n\treadonly typeCheck?: boolean | undefined;\n}\n\nconst tscPath = (projectDir: string) => {\n\tconst require = createRequire(join(projectDir, 'package.json'));\n\tconst manifest = require.resolve('typescript/package.json');\n\tconst { bin } = require(manifest) as { readonly bin: Readonly<Record<string, string>> };\n\treturn resolve(dirname(manifest), bin.tsc ?? 'bin/tsc');\n};\n\n/**\n * Runs `tsc --noEmit --runExternalCode` for the project's tsconfig, and rejects when it reports errors. Resolves without\n * checking when the tsconfig does not exist.\n */\nexport const typeCheck = async (projectDir: string, tsconfigPath = 'tsconfig.json'): Promise<void> => {\n\tconst project = resolve(projectDir, tsconfigPath);\n\tif (!existsSync(project)) return;\n\tconst tsc = spawn(process.execPath, [tscPath(projectDir), '--noEmit', '--runExternalCode', '--project', project], {\n\t\tcwd: projectDir,\n\t\tstdio: 'inherit',\n\t});\n\tconst [code] = (await once(tsc, 'exit')) as [number | null];\n\tif (code !== 0) throw new Error(`Type check failed: tsc --noEmit --runExternalCode --project ${project}`);\n};\n\n/**\n * Adds tyfigo to a Next.js config: a webpack rule and Turbopack rules for config imports, with the browser rule for client and\n * Edge code, and a type check that can read config imports.\n */\nexport const withTyfigo = (nextConfig: NextConfig = {}, options: WithTyfigoOptions = {}): NextConfig => {\n\tconst { typeCheck: check = !nextConfig.typescript?.ignoreBuildErrors, ...loader } = options;\n\tconst rule = (target: 'server' | 'browser') => ({\n\t\ttest: configFilePattern,\n\t\ttype: 'javascript/auto',\n\t\tuse: [{ loader: loaderPath, options: loaderOptions(loader, target) }],\n\t});\n\tconst config: NextConfig = {\n\t\t...nextConfig,\n\t\texperimental: { useTypeScriptCli: true, ...nextConfig.experimental },\n\t\tturbopack: {\n\t\t\t...nextConfig.turbopack,\n\t\t\trules: { ...turbopackRules(loader), ...nextConfig.turbopack?.rules },\n\t\t},\n\t\twebpack: (webpackConfig: { module: { rules: unknown[] } }, context) => {\n\t\t\tif (!context.isServer || context.nextRuntime === 'edge') webpackConfig.module.rules.push(rule('browser'));\n\t\t\telse {\n\t\t\t\twebpackConfig.module.rules.push(\n\t\t\t\t\t{ ...rule('browser'), issuerLayer: 'ssr' },\n\t\t\t\t\t{ ...rule('server'), issuerLayer: { not: 'ssr' } },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn nextConfig.webpack ? nextConfig.webpack(webpackConfig, context) : webpackConfig;\n\t\t},\n\t};\n\tif (!check) return config;\n\n\treturn {\n\t\t...config,\n\t\ttypescript: { ...nextConfig.typescript, ignoreBuildErrors: true },\n\t\tcompiler: {\n\t\t\t...nextConfig.compiler,\n\t\t\trunAfterProductionCompile: async (metadata) => {\n\t\t\t\tawait nextConfig.compiler?.runAfterProductionCompile?.(metadata);\n\t\t\t\tawait typeCheck(metadata.projectDir, nextConfig.typescript?.tsconfigPath);\n\t\t\t},\n\t\t},\n\t};\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,aAAa,cAAc,IAAI,IAAI,SAAS,QAAQ,YAAY,GAAG,KAAK,YAAY,GAAG,CAAC;AAErG,MAAa,iBAAiB,SAA8C,YAAwB;CACnG;CACA,G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,CAAC,WAAW,YAAY,mBAAmB,GAAG,WAAW;CACpF,MAAM,QAAQ,YAAkC;EAC/C,MAAM;EACN,MAAM;EACN,KAAK,CAAC;GAAE,QAAQ;GAAY,SAAS,cAAc,QAAQ,MAAM;EAAE,CAAC;CACrE;CACA,MAAM,SAAqB;EAC1B,GAAG;EACH,cAAc;GAAE,kBAAkB;GAAM,GAAG,WAAW;EAAa;EACnE,WAAW;GACV,GAAG,WAAW;GACd,OAAO;IAAE,GAAG,eAAe,MAAM;IAAG,GAAG,WAAW,WAAW;GAAM;EACpE;EACA,UAAU,eAAiD,YAAY;GACtE,IAAI,CAAC,QAAQ,YAAY,QAAQ,gBAAgB,QAAQ,cAAc,OAAO,MAAM,KAAK,KAAK,SAAS,CAAC;QAEvG,cAAc,OAAO,MAAM,KAC1B;IAAE,GAAG,KAAK,SAAS;IAAG,aAAa;GAAM,GACzC;IAAE,GAAG,KAAK,QAAQ;IAAG,aAAa,EAAE,KAAK,MAAM;GAAE,CAClD;GAED,OAAO,WAAW,UAAU,WAAW,QAAQ,eAAe,OAAO,IAAI;EAC1E;CACD;CACA,IAAI,CAAC,OAAO,OAAO;CAEnB,OAAO;EACN,GAAG;EACH,YAAY;GAAE,GAAG,WAAW;GAAY,mBAAmB;EAAK;EAChE,UAAU;GACT,GAAG,WAAW;GACd,2BAA2B,OAAO,aAAa;IAC9C,MAAM,WAAW,UAAU,4BAA4B,QAAQ;IAC/D,MAAM,UAAU,SAAS,YAAY,WAAW,YAAY,YAAY;GACzE;EACD;CACD;AACD"}
@@ -0,0 +1,5 @@
1
+ import { t as TyfigoPluginOptions } from "../shared-CLa0Be_8.mjs";
2
+ import "../unplugin-ce5g3K3a.mjs";
3
+ declare const _default: (options?: TyfigoPluginOptions | undefined) => import("rolldown").Plugin<any>;
4
+ export { type TyfigoPluginOptions, _default as default };
5
+ //# sourceMappingURL=rolldown.d.mts.map
@@ -0,0 +1,6 @@
1
+ import { t as tyfigo } from "../unplugin-DXVarwkX.mjs";
2
+ // src/plugins/rolldown.ts
3
+ var rolldown_default = tyfigo.rolldown;
4
+ export { rolldown_default as default };
5
+
6
+ //# sourceMappingURL=rolldown.mjs.map