@effected/tsconfig-json 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ import { CompilerOptions } from "./CompilerOptions.js";
2
+ import { TsEnumCodec } from "./TsEnumCodec.js";
3
+ import { Schema, SchemaTransformation } from "effect";
4
+
5
+ //#region src/CompilerOptionsFromProgrammatic.ts
6
+ const normalizeIn = (input) => TsEnumCodec.decodeCompilerOptions(input);
7
+ const encodeOut = (encoded) => TsEnumCodec.encodeCompilerOptions(encoded);
8
+ /**
9
+ * A codec between the **programmatic** `compilerOptions` shape TypeScript's own
10
+ * API uses and this package's decoded {@link (CompilerOptions:namespace).Type}.
11
+ *
12
+ * Decoding accepts the numeric-enum spelling (`{ target: ts.ScriptTarget.ES2025 }`),
13
+ * the canonical string spelling, case-varying strings (`"ESNext"`), any mixture of
14
+ * the three in one object, and `lib` entries in any of their three spellings
15
+ * (`"esnext"`, `"lib.esnext.d.ts"`, an absolute path to the lib file) — producing
16
+ * validated {@link (CompilerOptions:namespace).Type} with canonical lowercase enum
17
+ * strings and short-form `lib`. Unknown and dead keys pass through, exactly as
18
+ * {@link (CompilerOptions:variable)} itself allows. Decoding is idempotent on
19
+ * already-canonical input.
20
+ *
21
+ * Encoding is {@link TsEnumCodec.encodeCompilerOptions}: numeric enum values and
22
+ * `lib` in the file-name form (`lib.esnext.d.ts`).
23
+ *
24
+ * @remarks
25
+ * A numeric value with no table entry — a future TypeScript enum member — survives
26
+ * normalization as a number and then **fails decode** with a typed schema issue,
27
+ * rather than passing through. That is deliberate: this is the validating door
28
+ * {@link TsEnumCodec.decodeCompilerOptions} is not, which is why that function's
29
+ * return type stays the wider `Record<string, unknown>`.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * import { Schema } from "effect";
34
+ * import { CompilerOptionsFromProgrammatic } from "@effected/tsconfig-json";
35
+ *
36
+ * // { target: "es2025", strict: true, lib: ["esnext"] }
37
+ * Schema.decodeUnknownSync(CompilerOptionsFromProgrammatic)({
38
+ * target: 12,
39
+ * strict: true,
40
+ * lib: ["lib.esnext.d.ts"],
41
+ * });
42
+ * ```
43
+ *
44
+ * @public
45
+ */
46
+ const CompilerOptionsFromProgrammatic = Schema.Record(Schema.String, Schema.Unknown).pipe(Schema.decodeTo(CompilerOptions, SchemaTransformation.transform({
47
+ decode: normalizeIn,
48
+ encode: encodeOut
49
+ })));
50
+
51
+ //#endregion
52
+ export { CompilerOptionsFromProgrammatic };
package/README.md CHANGED
@@ -114,7 +114,7 @@ const compilerOptions = TsconfigLoaderSync.compilerOptions("./tsconfig.json", op
114
114
  TypeScript 7's native `tsc` ships a version-only stub as its `.` export — there is no JS compiler API behind it. A package that drives the typechecker as a library (`@typescript/vfs`, the language service, the Program API) can neither type against nor runtime-load a TypeScript 7 install, and the obvious fix of pinning the dev `typescript` back to 6 forfeits the native `tsc` and leaves toolchain peers on `^7` unmet. The recipe that keeps both starts here, because this package is what removes the compile-time half of the dependency.
115
115
 
116
116
  1. Type against the tsconfig JSON form, not the compiler. Public option types use `CompilerOptions.Type` — `{ target: "es2022" }`, strings all the way down — so nothing in `src` or the tests imports `typescript`, not even as a type. The dev `typescript` stays on 7, native `tsc --noEmit` still runs the typecheck, and the toolchain's `^7` peer stays satisfied.
117
- 2. Convert at a single runtime seam. `TsEnumCodec.encodeCompilerOptions` maps the string form to the numeric enums a real compiler expects and returns `ProgrammaticCompilerOptions`, the shape a `ts.CompilerOptions`-typed API takes without a cast. Only that one call site knows a compiler exists.
117
+ 2. Convert at a single runtime seam. `TsEnumCodec.encodeCompilerOptions` maps the string form to the numeric enums a real compiler expects and returns `ProgrammaticCompilerOptions`, the shape a `ts.CompilerOptions`-typed API takes without a cast. Only that one call site knows a compiler exists. The inbound direction is `CompilerOptionsFromProgrammatic`, a schema rather than a function: hand it a live `ts.CompilerOptions`, a numeric enum literal or the output of `encodeCompilerOptions` and validated `CompilerOptions.Type` comes back, with an unmappable numeric failing decode instead of leaking through.
118
118
  3. Alias a classic install for the test runtime, where the JS API is genuinely needed: a dev-only `"typescript-classic": "npm:typescript@^6.0.3"` plus a vitest `resolve.alias` mapping `typescript` to it. The consumer-facing peer stays an optional `^6` — runtime-only, for callers of the compiler-touching module.
119
119
  4. Pass `tsLibDirectory` explicitly when you drive `@typescript/vfs`. It locates `lib.*.d.ts` through `require.resolve("typescript")`, which under this setup resolves the TypeScript 7 install, and that install has no lib directory: the map comes back **empty**, silently, with no error to follow. Derive the directory from the module you actually loaded.
120
120
 
@@ -159,6 +159,7 @@ console.log(fsMap.size);
159
159
  - `ResolvedTsconfig` — the pure merge engine behind `resolve`: per-field merge semantics, path-option absolutization against the declaring config's directory, final `${configDir}` substitution and `pathsBase` provenance, with no filesystem access at all.
160
160
  - `TsconfigDiscovery.findNearest` — the nearest `tsconfig.json` (or any filename via `options.filename`) at or above a starting directory, over `@effected/walker`; one unreadable ancestor cannot hide a config above it.
161
161
  - `TsEnumCodec` — the string↔numeric enum tables as plain data with zero `typescript` imports. `encodeCompilerOptions` returns the exported `ProgrammaticCompilerOptions` type — the numeric shape `ts.CompilerOptions` expects, so you hand it to a `ts.CompilerOptions`-shaped API without a cast — with `lib` entries in the file-name form the compiler resolves verbatim; `decodeCompilerOptions` reverses it.
162
+ - `CompilerOptionsFromProgrammatic` — the same tables as a validating codec, for callers holding TypeScript's programmatic spelling. Decode accepts numeric enums, canonical strings, case-varying strings, any mixture of the three and `lib` in any of its three spellings; encode returns the numeric form. A numeric with no table entry fails decode as a typed schema issue rather than passing through, which is the check `TsEnumCodec.decodeCompilerOptions` deliberately does not make.
162
163
  - `PortableTsconfig.make` — an allow-list projection down to machine-independent type-semantics options, with `composite: false` and `noEmit: true` forced: the slice a virtual TypeScript environment (Twoslash, API Extractor, an in-memory language service) can safely inherit. An optional `{ includeTypes }` argument carries the source config's `types` package names onto the portable shape too, for a caller whose virtual environment can resolve `@types` packages itself; `typeRoots` stays dropped either way, since it names machine-specific, config-location-dependent directories.
163
164
  - `JsxConfig.fromCompilerOptions` — the JSX transform a bundler can configure, projected from decoded options: `react-jsx` / `react-jsxdev` select the automatic runtime with its import source (defaulting to `react`, tsc's own default), `react` selects classic, and `preserve`, `react-native` or an absent `jsx` yield `Option.none()`.
164
165
  - Typed failures everywhere: a malformed file is a `TsconfigParseError` carrying its path, a broken chain is a `TsconfigExtendsError` with a `not-found` / `cycle` / `depth` / `empty` reason and the full resolution chain, and IO errors flow through as `PlatformError`. Nothing fails as a defect.
package/index.d.ts CHANGED
@@ -8,39 +8,39 @@ import { Effect, FileSystem, Option, Path, PlatformError, Schema } from "effect"
8
8
  *
9
9
  * @public
10
10
  */
11
- declare const Target: Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext"]>, Schema.String, never, never>;
11
+ export declare const Target: Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext"]>, Schema.String, never, never>;
12
12
  /**
13
13
  * `compilerOptions.module` — the module output format. `none`, `amd`, `umd`
14
14
  * and `system` are deprecated in TS 6.0.
15
15
  *
16
16
  * @public
17
17
  */
18
- declare const Module: Schema.decodeTo<Schema.Literals<readonly ["none", "commonjs", "amd", "umd", "system", "es6", "es2015", "es2020", "es2022", "esnext", "node16", "node18", "node20", "nodenext", "preserve"]>, Schema.String, never, never>;
18
+ export declare const Module: Schema.decodeTo<Schema.Literals<readonly ["none", "commonjs", "amd", "umd", "system", "es6", "es2015", "es2020", "es2022", "esnext", "node16", "node18", "node20", "nodenext", "preserve"]>, Schema.String, never, never>;
19
19
  /**
20
20
  * `compilerOptions.moduleResolution`. `node10`, `node` and `classic` are
21
21
  * deprecated in TS 6.0.
22
22
  *
23
23
  * @public
24
24
  */
25
- declare const ModuleResolution: Schema.decodeTo<Schema.Literals<readonly ["node10", "node", "classic", "node16", "nodenext", "bundler"]>, Schema.String, never, never>;
25
+ export declare const ModuleResolution: Schema.decodeTo<Schema.Literals<readonly ["node10", "node", "classic", "node16", "nodenext", "bundler"]>, Schema.String, never, never>;
26
26
  /**
27
27
  * `compilerOptions.jsx`. There is no `none` literal — tsc's option map has
28
28
  * only these five.
29
29
  *
30
30
  * @public
31
31
  */
32
- declare const Jsx: Schema.decodeTo<Schema.Literals<readonly ["preserve", "react-native", "react-jsx", "react-jsxdev", "react"]>, Schema.String, never, never>;
32
+ export declare const Jsx: Schema.decodeTo<Schema.Literals<readonly ["preserve", "react-native", "react-jsx", "react-jsxdev", "react"]>, Schema.String, never, never>;
33
33
  /** `compilerOptions.newLine`. @public */
34
- declare const NewLine: Schema.decodeTo<Schema.Literals<readonly ["crlf", "lf"]>, Schema.String, never, never>;
34
+ export declare const NewLine: Schema.decodeTo<Schema.Literals<readonly ["crlf", "lf"]>, Schema.String, never, never>;
35
35
  /** `compilerOptions.moduleDetection`. @public */
36
- declare const ModuleDetection: Schema.decodeTo<Schema.Literals<readonly ["auto", "legacy", "force"]>, Schema.String, never, never>;
36
+ export declare const ModuleDetection: Schema.decodeTo<Schema.Literals<readonly ["auto", "legacy", "force"]>, Schema.String, never, never>;
37
37
  /**
38
38
  * `compilerOptions.lib` member values — the complete TS 6.0.3 set, lowercase
39
39
  * canonical, per R1.2.
40
40
  *
41
41
  * @public
42
42
  */
43
- declare const Lib: Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es7", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext", "dom", "dom.iterable", "dom.asynciterable", "webworker", "webworker.importscripts", "webworker.iterable", "webworker.asynciterable", "scripthost", "es2015.core", "es2015.collection", "es2015.generator", "es2015.iterable", "es2015.promise", "es2015.proxy", "es2015.reflect", "es2015.symbol", "es2015.symbol.wellknown", "es2016.array.include", "es2016.intl", "es2017.arraybuffer", "es2017.date", "es2017.object", "es2017.sharedmemory", "es2017.string", "es2017.intl", "es2017.typedarrays", "es2018.asyncgenerator", "es2018.asynciterable", "es2018.intl", "es2018.promise", "es2018.regexp", "es2019.array", "es2019.object", "es2019.string", "es2019.symbol", "es2019.intl", "es2020.bigint", "es2020.date", "es2020.promise", "es2020.sharedmemory", "es2020.string", "es2020.symbol.wellknown", "es2020.intl", "es2020.number", "es2021.promise", "es2021.string", "es2021.weakref", "es2021.intl", "es2022.array", "es2022.error", "es2022.intl", "es2022.object", "es2022.string", "es2022.regexp", "es2023.array", "es2023.collection", "es2023.intl", "es2024.arraybuffer", "es2024.collection", "es2024.object", "es2024.promise", "es2024.regexp", "es2024.sharedmemory", "es2024.string", "es2025.collection", "es2025.float16", "es2025.intl", "es2025.iterator", "es2025.promise", "es2025.regexp", "esnext.asynciterable", "esnext.symbol", "esnext.bigint", "esnext.weakref", "esnext.object", "esnext.regexp", "esnext.string", "esnext.float16", "esnext.iterator", "esnext.promise", "esnext.array", "esnext.collection", "esnext.date", "esnext.decorators", "esnext.disposable", "esnext.error", "esnext.intl", "esnext.sharedmemory", "esnext.temporal", "esnext.typedarrays", "decorators", "decorators.legacy"]>, Schema.String, never, never>;
43
+ export declare const Lib: Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es7", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext", "dom", "dom.iterable", "dom.asynciterable", "webworker", "webworker.importscripts", "webworker.iterable", "webworker.asynciterable", "scripthost", "es2015.core", "es2015.collection", "es2015.generator", "es2015.iterable", "es2015.promise", "es2015.proxy", "es2015.reflect", "es2015.symbol", "es2015.symbol.wellknown", "es2016.array.include", "es2016.intl", "es2017.arraybuffer", "es2017.date", "es2017.object", "es2017.sharedmemory", "es2017.string", "es2017.intl", "es2017.typedarrays", "es2018.asyncgenerator", "es2018.asynciterable", "es2018.intl", "es2018.promise", "es2018.regexp", "es2019.array", "es2019.object", "es2019.string", "es2019.symbol", "es2019.intl", "es2020.bigint", "es2020.date", "es2020.promise", "es2020.sharedmemory", "es2020.string", "es2020.symbol.wellknown", "es2020.intl", "es2020.number", "es2021.promise", "es2021.string", "es2021.weakref", "es2021.intl", "es2022.array", "es2022.error", "es2022.intl", "es2022.object", "es2022.string", "es2022.regexp", "es2023.array", "es2023.collection", "es2023.intl", "es2024.arraybuffer", "es2024.collection", "es2024.object", "es2024.promise", "es2024.regexp", "es2024.sharedmemory", "es2024.string", "es2025.collection", "es2025.float16", "es2025.intl", "es2025.iterator", "es2025.promise", "es2025.regexp", "esnext.asynciterable", "esnext.symbol", "esnext.bigint", "esnext.weakref", "esnext.object", "esnext.regexp", "esnext.string", "esnext.float16", "esnext.iterator", "esnext.promise", "esnext.array", "esnext.collection", "esnext.date", "esnext.decorators", "esnext.disposable", "esnext.error", "esnext.intl", "esnext.sharedmemory", "esnext.temporal", "esnext.typedarrays", "decorators", "decorators.legacy"]>, Schema.String, never, never>;
44
44
  /**
45
45
  * `compilerOptions`, decoded as every R1.3-live boolean, R1.4 string/path/
46
46
  * array/record/number, and R1.2 enum field — each `optionalKey` — intersected
@@ -49,7 +49,7 @@ declare const Lib: Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es7"
49
49
  *
50
50
  * @public
51
51
  */
52
- declare const CompilerOptions: Schema.StructWithRest<Schema.Struct<{
52
+ export declare const CompilerOptions: Schema.StructWithRest<Schema.Struct<{
53
53
  readonly target: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext"]>, Schema.String, never, never>>;
54
54
  readonly module: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["none", "commonjs", "amd", "umd", "system", "es6", "es2015", "es2020", "es2022", "esnext", "node16", "node18", "node20", "nodenext", "preserve"]>, Schema.String, never, never>>;
55
55
  readonly moduleResolution: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["node10", "node", "classic", "node16", "nodenext", "bundler"]>, Schema.String, never, never>>;
@@ -175,7 +175,7 @@ declare const CompilerOptions: Schema.StructWithRest<Schema.Struct<{
175
175
  *
176
176
  * @public
177
177
  */
178
- declare namespace CompilerOptions {
178
+ export declare namespace CompilerOptions {
179
179
  /**
180
180
  * The decoded `compilerOptions` shape: every typed field optional, plus passthrough for unknown keys.
181
181
  *
@@ -190,6 +190,59 @@ declare namespace CompilerOptions {
190
190
  type Encoded = typeof CompilerOptions.Encoded;
191
191
  }
192
192
  //#endregion
193
+ //#region src/CompilerOptionsFromProgrammatic.d.ts
194
+ /**
195
+ * The untyped record this codec accepts on its encoded side. Exported because
196
+ * it names the codec's encoded type in the public signature; the values stay
197
+ * `unknown` rather than {@link ProgrammaticCompilerOptionsValue} because decode
198
+ * validates them and must be able to receive anything, including the
199
+ * unmappable numeric it exists to reject.
200
+ *
201
+ * @public
202
+ */
203
+ interface ProgrammaticRecord {
204
+ readonly [key: string]: unknown;
205
+ }
206
+ /**
207
+ * A codec between the **programmatic** `compilerOptions` shape TypeScript's own
208
+ * API uses and this package's decoded {@link (CompilerOptions:namespace).Type}.
209
+ *
210
+ * Decoding accepts the numeric-enum spelling (`{ target: ts.ScriptTarget.ES2025 }`),
211
+ * the canonical string spelling, case-varying strings (`"ESNext"`), any mixture of
212
+ * the three in one object, and `lib` entries in any of their three spellings
213
+ * (`"esnext"`, `"lib.esnext.d.ts"`, an absolute path to the lib file) — producing
214
+ * validated {@link (CompilerOptions:namespace).Type} with canonical lowercase enum
215
+ * strings and short-form `lib`. Unknown and dead keys pass through, exactly as
216
+ * {@link (CompilerOptions:variable)} itself allows. Decoding is idempotent on
217
+ * already-canonical input.
218
+ *
219
+ * Encoding is {@link TsEnumCodec.encodeCompilerOptions}: numeric enum values and
220
+ * `lib` in the file-name form (`lib.esnext.d.ts`).
221
+ *
222
+ * @remarks
223
+ * A numeric value with no table entry — a future TypeScript enum member — survives
224
+ * normalization as a number and then **fails decode** with a typed schema issue,
225
+ * rather than passing through. That is deliberate: this is the validating door
226
+ * {@link TsEnumCodec.decodeCompilerOptions} is not, which is why that function's
227
+ * return type stays the wider `Record<string, unknown>`.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * import { Schema } from "effect";
232
+ * import { CompilerOptionsFromProgrammatic } from "@effected/tsconfig-json";
233
+ *
234
+ * // { target: "es2025", strict: true, lib: ["esnext"] }
235
+ * Schema.decodeUnknownSync(CompilerOptionsFromProgrammatic)({
236
+ * target: 12,
237
+ * strict: true,
238
+ * lib: ["lib.esnext.d.ts"],
239
+ * });
240
+ * ```
241
+ *
242
+ * @public
243
+ */
244
+ export declare const CompilerOptionsFromProgrammatic: Schema.Codec<typeof CompilerOptions.Type, ProgrammaticRecord>;
245
+ //#endregion
193
246
  //#region src/JsxConfig.d.ts
194
247
  declare const JsxConfig_base: Schema.Class<JsxConfig, Schema.Struct<{
195
248
  /** The JSX transform runtime: `"automatic"` (`react-jsx` / `react-jsxdev`) or `"classic"` (`react`). */
@@ -205,7 +258,7 @@ declare const JsxConfig_base: Schema.Class<JsxConfig, Schema.Struct<{
205
258
  *
206
259
  * @public
207
260
  */
208
- declare class JsxConfig extends JsxConfig_base {
261
+ export declare class JsxConfig extends JsxConfig_base {
209
262
  /**
210
263
  * Project decoded compiler options to their implied JSX transform
211
264
  * configuration. `"react-jsx"` and `"react-jsxdev"` yield the automatic
@@ -220,18 +273,18 @@ declare class JsxConfig extends JsxConfig_base {
220
273
  //#endregion
221
274
  //#region src/TsconfigJson.d.ts
222
275
  /** `watchOptions.watchFile`. @public */
223
- declare const WatchFile: Schema.decodeTo<Schema.Literals<readonly ["fixedpollinginterval", "prioritypollinginterval", "dynamicprioritypolling", "fixedchunksizepolling", "usefsevents", "usefseventsonparentdirectory"]>, Schema.String, never, never>;
276
+ export declare const WatchFile: Schema.decodeTo<Schema.Literals<readonly ["fixedpollinginterval", "prioritypollinginterval", "dynamicprioritypolling", "fixedchunksizepolling", "usefsevents", "usefseventsonparentdirectory"]>, Schema.String, never, never>;
224
277
  /** `watchOptions.watchDirectory`. @public */
225
- declare const WatchDirectory: Schema.decodeTo<Schema.Literals<readonly ["usefsevents", "fixedpollinginterval", "dynamicprioritypolling", "fixedchunksizepolling"]>, Schema.String, never, never>;
278
+ export declare const WatchDirectory: Schema.decodeTo<Schema.Literals<readonly ["usefsevents", "fixedpollinginterval", "dynamicprioritypolling", "fixedchunksizepolling"]>, Schema.String, never, never>;
226
279
  /** `watchOptions.fallbackPolling`. @public */
227
- declare const FallbackPolling: Schema.decodeTo<Schema.Literals<readonly ["fixedinterval", "priorityinterval", "dynamicpriority", "fixedchunksize"]>, Schema.String, never, never>;
280
+ export declare const FallbackPolling: Schema.decodeTo<Schema.Literals<readonly ["fixedinterval", "priorityinterval", "dynamicpriority", "fixedchunksize"]>, Schema.String, never, never>;
228
281
  /**
229
282
  * One `references[]` entry: `path` is required and non-empty; every other key
230
283
  * is preserved verbatim (per R1.5).
231
284
  *
232
285
  * @public
233
286
  */
234
- declare const Reference: Schema.StructWithRest<Schema.Struct<{
287
+ export declare const Reference: Schema.StructWithRest<Schema.Struct<{
235
288
  readonly path: Schema.String;
236
289
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
237
290
  /**
@@ -239,7 +292,7 @@ declare const Reference: Schema.StructWithRest<Schema.Struct<{
239
292
  *
240
293
  * @public
241
294
  */
242
- declare namespace Reference {
295
+ export declare namespace Reference {
243
296
  /**
244
297
  * The decoded `references[]` entry shape.
245
298
  *
@@ -259,7 +312,7 @@ declare namespace Reference {
259
312
  *
260
313
  * @public
261
314
  */
262
- declare const WatchOptions: Schema.StructWithRest<Schema.Struct<{
315
+ export declare const WatchOptions: Schema.StructWithRest<Schema.Struct<{
263
316
  readonly watchFile: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["fixedpollinginterval", "prioritypollinginterval", "dynamicprioritypolling", "fixedchunksizepolling", "usefsevents", "usefseventsonparentdirectory"]>, Schema.String, never, never>>;
264
317
  readonly watchDirectory: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["usefsevents", "fixedpollinginterval", "dynamicprioritypolling", "fixedchunksizepolling"]>, Schema.String, never, never>>;
265
318
  readonly fallbackPolling: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["fixedinterval", "priorityinterval", "dynamicpriority", "fixedchunksize"]>, Schema.String, never, never>>;
@@ -272,7 +325,7 @@ declare const WatchOptions: Schema.StructWithRest<Schema.Struct<{
272
325
  *
273
326
  * @public
274
327
  */
275
- declare namespace WatchOptions {
328
+ export declare namespace WatchOptions {
276
329
  /**
277
330
  * The decoded `watchOptions` shape.
278
331
  *
@@ -291,7 +344,7 @@ declare namespace WatchOptions {
291
344
  *
292
345
  * @public
293
346
  */
294
- declare const TypeAcquisition: Schema.StructWithRest<Schema.Struct<{
347
+ export declare const TypeAcquisition: Schema.StructWithRest<Schema.Struct<{
295
348
  readonly enable: Schema.optionalKey<Schema.Boolean>;
296
349
  readonly include: Schema.optionalKey<Schema.$Array<Schema.String>>;
297
350
  readonly exclude: Schema.optionalKey<Schema.$Array<Schema.String>>;
@@ -302,7 +355,7 @@ declare const TypeAcquisition: Schema.StructWithRest<Schema.Struct<{
302
355
  *
303
356
  * @public
304
357
  */
305
- declare namespace TypeAcquisition {
358
+ export declare namespace TypeAcquisition {
306
359
  /**
307
360
  * The decoded `typeAcquisition` shape.
308
361
  *
@@ -324,7 +377,7 @@ declare namespace TypeAcquisition {
324
377
  *
325
378
  * @public
326
379
  */
327
- declare const TsconfigJson: Schema.StructWithRest<Schema.Struct<{
380
+ export declare const TsconfigJson: Schema.StructWithRest<Schema.Struct<{
328
381
  readonly compilerOptions: Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
329
382
  readonly target: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021", "es2022", "es2023", "es2024", "es2025", "esnext"]>, Schema.String, never, never>>;
330
383
  readonly module: Schema.optionalKey<Schema.decodeTo<Schema.Literals<readonly ["none", "commonjs", "amd", "umd", "system", "es6", "es2015", "es2020", "es2022", "esnext", "node16", "node18", "node20", "nodenext", "preserve"]>, Schema.String, never, never>>;
@@ -469,7 +522,7 @@ declare const TsconfigJson: Schema.StructWithRest<Schema.Struct<{
469
522
  *
470
523
  * @public
471
524
  */
472
- declare namespace TsconfigJson {
525
+ export declare namespace TsconfigJson {
473
526
  /**
474
527
  * The decoded tsconfig.json shape: every typed field optional, plus passthrough for unknown keys.
475
528
  *
@@ -493,7 +546,7 @@ declare namespace TsconfigJson {
493
546
  *
494
547
  * @public
495
548
  */
496
- declare const TsconfigJsonFromString: Schema.Codec<typeof TsconfigJson.Type, string>;
549
+ export declare const TsconfigJsonFromString: Schema.Codec<typeof TsconfigJson.Type, string>;
497
550
  declare const TsconfigParseError_base: Schema.Class<TsconfigParseError, Schema.TaggedStruct<"TsconfigParseError", {
498
551
  /** The file path that failed to parse, or `""` when not file-bound. */
499
552
  readonly path: Schema.String;
@@ -508,7 +561,7 @@ declare const TsconfigParseError_base: Schema.Class<TsconfigParseError, Schema.T
508
561
  *
509
562
  * @public
510
563
  */
511
- declare class TsconfigParseError extends TsconfigParseError_base {
564
+ export declare class TsconfigParseError extends TsconfigParseError_base {
512
565
  get message(): string;
513
566
  }
514
567
  //#endregion
@@ -522,7 +575,7 @@ declare class TsconfigParseError extends TsconfigParseError_base {
522
575
  *
523
576
  * @public
524
577
  */
525
- interface ResolvedTsconfig {
578
+ export interface ResolvedTsconfig {
526
579
  /** The own (most-derived) config's path — the last of {@link (ResolvedTsconfig:interface).extendedPaths}. */
527
580
  readonly configPath: string;
528
581
  /** The full resolution chain, base-most first and own config last. */
@@ -556,7 +609,7 @@ interface ResolvedTsconfig {
556
609
  *
557
610
  * @public
558
611
  */
559
- declare class ResolvedTsconfig {
612
+ export declare class ResolvedTsconfig {
560
613
  private constructor();
561
614
  /**
562
615
  * Absolutize a config's path-typed options (E5) against its own
@@ -597,7 +650,7 @@ declare class ResolvedTsconfig {
597
650
  *
598
651
  * @public
599
652
  */
600
- interface PortableTsconfig {
653
+ export interface PortableTsconfig {
601
654
  /** The tsconfig JSON Schema URL, stamped for IDE support. */
602
655
  readonly $schema: "https://json.schemastore.org/tsconfig";
603
656
  /** The allow-listed, forced-flag-applied compiler options. */
@@ -632,7 +685,7 @@ interface PortableTsconfigOptions {
632
685
  *
633
686
  * @public
634
687
  */
635
- declare class PortableTsconfig {
688
+ export declare class PortableTsconfig {
636
689
  private constructor();
637
690
  /**
638
691
  * Project a {@link (ResolvedTsconfig:interface)} or a bare
@@ -678,7 +731,7 @@ interface FindNearestOptions {
678
731
  *
679
732
  * @public
680
733
  */
681
- declare class TsconfigDiscovery {
734
+ export declare class TsconfigDiscovery {
682
735
  private constructor();
683
736
  /**
684
737
  * Find the nearest `tsconfig.json` (or `options.filename`) at or above
@@ -713,7 +766,7 @@ declare const TsconfigExtendsError_base: Schema.Class<TsconfigExtendsError, Sche
713
766
  *
714
767
  * @public
715
768
  */
716
- declare class TsconfigExtendsError extends TsconfigExtendsError_base {
769
+ export declare class TsconfigExtendsError extends TsconfigExtendsError_base {
717
770
  get message(): string;
718
771
  }
719
772
  /**
@@ -724,7 +777,7 @@ declare class TsconfigExtendsError extends TsconfigExtendsError_base {
724
777
  *
725
778
  * @public
726
779
  */
727
- declare class TsconfigLoader {
780
+ export declare class TsconfigLoader {
728
781
  private constructor();
729
782
  /**
730
783
  * Read one config file and decode it through {@link TsconfigJsonFromString}.
@@ -1120,7 +1173,7 @@ interface TsconfigLoaderSyncOptions {
1120
1173
  *
1121
1174
  * @public
1122
1175
  */
1123
- declare class TsconfigLoaderSync {
1176
+ export declare class TsconfigLoaderSync {
1124
1177
  private constructor();
1125
1178
  /**
1126
1179
  * {@link TsconfigLoader.load}, synchronously: read and decode one config
@@ -1242,7 +1295,7 @@ interface ProgrammaticCompilerOptions {
1242
1295
  *
1243
1296
  * @public
1244
1297
  */
1245
- declare class TsEnumCodec {
1298
+ export declare class TsEnumCodec {
1246
1299
  private constructor();
1247
1300
  /**
1248
1301
  * Encodes a family's canonical (or alias) string spelling to its numeric
@@ -1299,5 +1352,5 @@ declare class TsEnumCodec {
1299
1352
  static readonly decodeCompilerOptions: (numeric: Readonly<Record<string, unknown>>) => Record<string, unknown>;
1300
1353
  }
1301
1354
  //#endregion
1302
- export { CompilerOptions, type EnumFamily, FallbackPolling, type FindNearestOptions, Jsx, JsxConfig, Lib, Module, ModuleDetection, ModuleResolution, NewLine, PortableTsconfig, type PortableTsconfigOptions, type ProgrammaticCompilerOptions, type ProgrammaticCompilerOptionsValue, Reference, ResolvedTsconfig, type SyncFileSystem, type SyncPath, Target, TsEnumCodec, TsconfigDiscovery, TsconfigExtendsError, TsconfigJson, TsconfigJsonFromString, TsconfigLoader, TsconfigLoaderSync, type TsconfigLoaderSyncOptions, TsconfigParseError, TypeAcquisition, WatchDirectory, WatchFile, WatchOptions };
1355
+ export type { EnumFamily, FindNearestOptions, PortableTsconfigOptions, ProgrammaticCompilerOptions, ProgrammaticCompilerOptionsValue, ProgrammaticRecord, SyncFileSystem, SyncPath, TsconfigLoaderSyncOptions };
1303
1356
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { CompilerOptions, Jsx, Lib, Module, ModuleDetection, ModuleResolution, NewLine, Target } from "./CompilerOptions.js";
2
+ import { TsEnumCodec } from "./TsEnumCodec.js";
3
+ import { CompilerOptionsFromProgrammatic } from "./CompilerOptionsFromProgrammatic.js";
2
4
  import { JsxConfig } from "./JsxConfig.js";
3
5
  import { PortableTsconfig } from "./PortableTsconfig.js";
4
6
  import { ResolvedTsconfig } from "./ResolvedTsconfig.js";
@@ -6,6 +8,5 @@ import { TsconfigDiscovery } from "./TsconfigDiscovery.js";
6
8
  import { FallbackPolling, Reference, TsconfigJson, TsconfigJsonFromString, TsconfigParseError, TypeAcquisition, WatchDirectory, WatchFile, WatchOptions } from "./TsconfigJson.js";
7
9
  import { TsconfigExtendsError, TsconfigLoader } from "./TsconfigLoader.js";
8
10
  import { TsconfigLoaderSync } from "./TsconfigLoaderSync.js";
9
- import { TsEnumCodec } from "./TsEnumCodec.js";
10
11
 
11
- export { CompilerOptions, FallbackPolling, Jsx, JsxConfig, Lib, Module, ModuleDetection, ModuleResolution, NewLine, PortableTsconfig, Reference, ResolvedTsconfig, Target, TsEnumCodec, TsconfigDiscovery, TsconfigExtendsError, TsconfigJson, TsconfigJsonFromString, TsconfigLoader, TsconfigLoaderSync, TsconfigParseError, TypeAcquisition, WatchDirectory, WatchFile, WatchOptions };
12
+ export { CompilerOptions, CompilerOptionsFromProgrammatic, FallbackPolling, Jsx, JsxConfig, Lib, Module, ModuleDetection, ModuleResolution, NewLine, PortableTsconfig, Reference, ResolvedTsconfig, Target, TsEnumCodec, TsconfigDiscovery, TsconfigExtendsError, TsconfigJson, TsconfigJsonFromString, TsconfigLoader, TsconfigLoaderSync, TsconfigParseError, TypeAcquisition, WatchDirectory, WatchFile, WatchOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/tsconfig-json",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "private": false,
5
5
  "description": "Composable tsconfig.json handling for Effect: schemas, extends-chain resolution, and config discovery.",
6
6
  "keywords": [
@@ -39,9 +39,9 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "peerDependencies": {
42
- "@effected/jsonc": "^0.8.0",
43
- "@effected/walker": "^0.5.0",
44
- "effect": "4.0.0-rc.109"
42
+ "@effected/jsonc": "^0.9.0",
43
+ "@effected/walker": "^0.6.0",
44
+ "effect": "4.0.0-rc.112"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24.11.0"