pgflow 0.0.1-prealpha.0 → 0.0.12
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.
- package/CHANGELOG.md +13 -0
- package/LICENSE.md +660 -0
- package/eslint.config.cjs +3 -0
- package/package.json +13 -6
- package/project.json +40 -0
- package/src/commands/install/copy-migrations.ts +101 -0
- package/src/commands/install/index.ts +45 -0
- package/src/commands/install/supabase-path-prompt.ts +28 -0
- package/src/commands/install/update-config-toml.ts +130 -0
- package/src/index.ts +76 -0
- package/src/types.d.ts +1 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +19 -0
- package/tsconfig.spec.json +33 -0
- package/vite.config.ts +25 -0
- package/dist/node_modules/.package-lock.json +0 -129
- package/dist/node_modules/@commander-js/extra-typings/LICENSE +0 -21
- package/dist/node_modules/@commander-js/extra-typings/README.md +0 -66
- package/dist/node_modules/@commander-js/extra-typings/esm.d.mts +0 -2
- package/dist/node_modules/@commander-js/extra-typings/esm.mjs +0 -16
- package/dist/node_modules/@commander-js/extra-typings/index.d.ts +0 -1467
- package/dist/node_modules/@commander-js/extra-typings/index.js +0 -25
- package/dist/node_modules/@commander-js/extra-typings/package.json +0 -63
- package/dist/node_modules/@esbuild/linux-x64/README.md +0 -3
- package/dist/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/dist/node_modules/@esbuild/linux-x64/package.json +0 -20
- package/dist/node_modules/commander/LICENSE +0 -22
- package/dist/node_modules/commander/Readme.md +0 -1149
- package/dist/node_modules/commander/esm.mjs +0 -16
- package/dist/node_modules/commander/index.js +0 -24
- package/dist/node_modules/commander/lib/argument.js +0 -149
- package/dist/node_modules/commander/lib/command.js +0 -2662
- package/dist/node_modules/commander/lib/error.js +0 -39
- package/dist/node_modules/commander/lib/help.js +0 -709
- package/dist/node_modules/commander/lib/option.js +0 -367
- package/dist/node_modules/commander/lib/suggestSimilar.js +0 -101
- package/dist/node_modules/commander/package-support.json +0 -16
- package/dist/node_modules/commander/package.json +0 -82
- package/dist/node_modules/commander/typings/esm.d.mts +0 -3
- package/dist/node_modules/commander/typings/index.d.ts +0 -1045
- package/dist/node_modules/esbuild/LICENSE.md +0 -21
- package/dist/node_modules/esbuild/README.md +0 -3
- package/dist/node_modules/esbuild/bin/esbuild +0 -0
- package/dist/node_modules/esbuild/install.js +0 -287
- package/dist/node_modules/esbuild/lib/main.d.ts +0 -705
- package/dist/node_modules/esbuild/lib/main.js +0 -2251
- package/dist/node_modules/esbuild/package.json +0 -48
- package/dist/node_modules/get-tsconfig/LICENSE +0 -21
- package/dist/node_modules/get-tsconfig/README.md +0 -235
- package/dist/node_modules/get-tsconfig/dist/index.cjs +0 -7
- package/dist/node_modules/get-tsconfig/dist/index.d.cts +0 -1439
- package/dist/node_modules/get-tsconfig/dist/index.d.mts +0 -1439
- package/dist/node_modules/get-tsconfig/dist/index.mjs +0 -7
- package/dist/node_modules/get-tsconfig/package.json +0 -46
- package/dist/node_modules/resolve-pkg-maps/LICENSE +0 -21
- package/dist/node_modules/resolve-pkg-maps/README.md +0 -216
- package/dist/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
- package/dist/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
- package/dist/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
- package/dist/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
- package/dist/node_modules/resolve-pkg-maps/package.json +0 -42
- package/dist/node_modules/tsx/LICENSE +0 -21
- package/dist/node_modules/tsx/README.md +0 -32
- package/dist/node_modules/tsx/dist/cjs/api/index.cjs +0 -1
- package/dist/node_modules/tsx/dist/cjs/api/index.d.cts +0 -35
- package/dist/node_modules/tsx/dist/cjs/api/index.d.mts +0 -35
- package/dist/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
- package/dist/node_modules/tsx/dist/cjs/index.cjs +0 -1
- package/dist/node_modules/tsx/dist/cjs/index.mjs +0 -1
- package/dist/node_modules/tsx/dist/cli.cjs +0 -54
- package/dist/node_modules/tsx/dist/cli.mjs +0 -55
- package/dist/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
- package/dist/node_modules/tsx/dist/client-D6NvIMSC.cjs +0 -1
- package/dist/node_modules/tsx/dist/esm/api/index.cjs +0 -1
- package/dist/node_modules/tsx/dist/esm/api/index.d.cts +0 -35
- package/dist/node_modules/tsx/dist/esm/api/index.d.mts +0 -35
- package/dist/node_modules/tsx/dist/esm/api/index.mjs +0 -1
- package/dist/node_modules/tsx/dist/esm/index.cjs +0 -2
- package/dist/node_modules/tsx/dist/esm/index.mjs +0 -2
- package/dist/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
- package/dist/node_modules/tsx/dist/get-pipe-path-BoR10qr8.cjs +0 -1
- package/dist/node_modules/tsx/dist/index-B4SIRlEU.cjs +0 -16
- package/dist/node_modules/tsx/dist/index-DlKgSVBb.mjs +0 -16
- package/dist/node_modules/tsx/dist/loader.cjs +0 -1
- package/dist/node_modules/tsx/dist/loader.mjs +0 -1
- package/dist/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
- package/dist/node_modules/tsx/dist/node-features-roYmp9jK.cjs +0 -1
- package/dist/node_modules/tsx/dist/package--YiorJOq.mjs +0 -1
- package/dist/node_modules/tsx/dist/package-BUuKnQXZ.cjs +0 -1
- package/dist/node_modules/tsx/dist/patch-repl.cjs +0 -1
- package/dist/node_modules/tsx/dist/patch-repl.mjs +0 -1
- package/dist/node_modules/tsx/dist/preflight.cjs +0 -1
- package/dist/node_modules/tsx/dist/preflight.mjs +0 -1
- package/dist/node_modules/tsx/dist/register-C3TE0KFF.mjs +0 -3
- package/dist/node_modules/tsx/dist/register-CVZT-Tul.cjs +0 -1
- package/dist/node_modules/tsx/dist/register-DCnOAxY2.cjs +0 -3
- package/dist/node_modules/tsx/dist/register-RyGUjI6j.mjs +0 -1
- package/dist/node_modules/tsx/dist/repl.cjs +0 -3
- package/dist/node_modules/tsx/dist/repl.mjs +0 -3
- package/dist/node_modules/tsx/dist/require-BnyFnlmk.mjs +0 -1
- package/dist/node_modules/tsx/dist/require-DBpSESet.cjs +0 -1
- package/dist/node_modules/tsx/dist/suppress-warnings.cjs +0 -1
- package/dist/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
- package/dist/node_modules/tsx/dist/temporary-directory-B83uKxJF.cjs +0 -1
- package/dist/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
- package/dist/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
- package/dist/node_modules/tsx/package.json +0 -68
- package/dist/package.json +0 -27
- package/dist/sql/000000_schema.sql +0 -150
- package/dist/sql/000005_create_flow.sql +0 -29
- package/dist/sql/000010_add_step.sql +0 -48
- package/dist/sql/000015_start_ready_steps.sql +0 -45
- package/dist/sql/000020_start_flow.sql +0 -46
- package/dist/sql/000030_read_with_poll_backport.sql +0 -70
- package/dist/sql/000040_poll_for_tasks.sql +0 -100
- package/dist/sql/000045_maybe_complete_run.sql +0 -30
- package/dist/sql/000050_complete_task.sql +0 -98
- package/dist/sql/000055_calculate_retry_delay.sql +0 -11
- package/dist/sql/000060_fail_task.sql +0 -124
- package/dist/sql/000_edge_worker_initial.sql +0 -86
- package/dist/src/commands/install.d.ts +0 -4
- package/dist/src/commands/install.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "esbuild",
|
|
3
|
-
"version": "0.25.2",
|
|
4
|
-
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/evanw/esbuild.git"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"postinstall": "node install.js"
|
|
11
|
-
},
|
|
12
|
-
"main": "lib/main.js",
|
|
13
|
-
"types": "lib/main.d.ts",
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=18"
|
|
16
|
-
},
|
|
17
|
-
"bin": {
|
|
18
|
-
"esbuild": "bin/esbuild"
|
|
19
|
-
},
|
|
20
|
-
"optionalDependencies": {
|
|
21
|
-
"@esbuild/aix-ppc64": "0.25.2",
|
|
22
|
-
"@esbuild/android-arm": "0.25.2",
|
|
23
|
-
"@esbuild/android-arm64": "0.25.2",
|
|
24
|
-
"@esbuild/android-x64": "0.25.2",
|
|
25
|
-
"@esbuild/darwin-arm64": "0.25.2",
|
|
26
|
-
"@esbuild/darwin-x64": "0.25.2",
|
|
27
|
-
"@esbuild/freebsd-arm64": "0.25.2",
|
|
28
|
-
"@esbuild/freebsd-x64": "0.25.2",
|
|
29
|
-
"@esbuild/linux-arm": "0.25.2",
|
|
30
|
-
"@esbuild/linux-arm64": "0.25.2",
|
|
31
|
-
"@esbuild/linux-ia32": "0.25.2",
|
|
32
|
-
"@esbuild/linux-loong64": "0.25.2",
|
|
33
|
-
"@esbuild/linux-mips64el": "0.25.2",
|
|
34
|
-
"@esbuild/linux-ppc64": "0.25.2",
|
|
35
|
-
"@esbuild/linux-riscv64": "0.25.2",
|
|
36
|
-
"@esbuild/linux-s390x": "0.25.2",
|
|
37
|
-
"@esbuild/linux-x64": "0.25.2",
|
|
38
|
-
"@esbuild/netbsd-arm64": "0.25.2",
|
|
39
|
-
"@esbuild/netbsd-x64": "0.25.2",
|
|
40
|
-
"@esbuild/openbsd-arm64": "0.25.2",
|
|
41
|
-
"@esbuild/openbsd-x64": "0.25.2",
|
|
42
|
-
"@esbuild/sunos-x64": "0.25.2",
|
|
43
|
-
"@esbuild/win32-arm64": "0.25.2",
|
|
44
|
-
"@esbuild/win32-ia32": "0.25.2",
|
|
45
|
-
"@esbuild/win32-x64": "0.25.2"
|
|
46
|
-
},
|
|
47
|
-
"license": "MIT"
|
|
48
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img width="160" src=".github/logo.webp">
|
|
3
|
-
</p>
|
|
4
|
-
<h1 align="center">
|
|
5
|
-
<sup>get-tsconfig</sup>
|
|
6
|
-
<br>
|
|
7
|
-
<a href="https://npm.im/get-tsconfig"><img src="https://badgen.net/npm/v/get-tsconfig"></a> <a href="https://npm.im/get-tsconfig"><img src="https://badgen.net/npm/dm/get-tsconfig"></a>
|
|
8
|
-
</h1>
|
|
9
|
-
|
|
10
|
-
Find and parse `tsconfig.json` files.
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
- Zero dependency (not even TypeScript)
|
|
14
|
-
- Tested against TypeScript for correctness
|
|
15
|
-
- Supports comments & dangling commas in `tsconfig.json`
|
|
16
|
-
- Resolves [`extends`](https://www.typescriptlang.org/tsconfig/#extends)
|
|
17
|
-
- Fully typed `tsconfig.json`
|
|
18
|
-
- Validates and throws parsing errors
|
|
19
|
-
- Tiny! `7 kB` Minified + Gzipped
|
|
20
|
-
|
|
21
|
-
<br>
|
|
22
|
-
|
|
23
|
-
<p align="center">
|
|
24
|
-
<a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=398771"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/donate.webp"></a>
|
|
25
|
-
<a href="https://github.com/sponsors/privatenumber/sponsorships?tier_id=397608"><img width="412" src="https://raw.githubusercontent.com/privatenumber/sponsors/master/banners/assets/sponsor.webp"></a>
|
|
26
|
-
</p>
|
|
27
|
-
<p align="center"><sup><i>Already a sponsor?</i> Join the discussion in the <a href="https://github.com/pvtnbr/get-tsconfig">Development repo</a>!</sup></p>
|
|
28
|
-
|
|
29
|
-
## Install
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm install get-tsconfig
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Why?
|
|
36
|
-
For TypeScript related tooling to correctly parse `tsconfig.json` file without depending on TypeScript.
|
|
37
|
-
|
|
38
|
-
## API
|
|
39
|
-
|
|
40
|
-
### getTsconfig(searchPath?, configName?, cache?)
|
|
41
|
-
|
|
42
|
-
Searches for a tsconfig file (defaults to `tsconfig.json`) in the `searchPath` and parses it. (If you already know the tsconfig path, use [`parseTsconfig`](#parsetsconfigtsconfigpath-cache) instead). Returns `null` if a config file cannot be found, or an object containing the path and parsed TSConfig object if found.
|
|
43
|
-
|
|
44
|
-
Returns:
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
type TsconfigResult = {
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The path to the tsconfig.json file
|
|
51
|
-
*/
|
|
52
|
-
path: string
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The resolved tsconfig.json file
|
|
56
|
-
*/
|
|
57
|
-
config: TsConfigJsonResolved
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
#### searchPath
|
|
62
|
-
Type: `string`
|
|
63
|
-
|
|
64
|
-
Default: `process.cwd()`
|
|
65
|
-
|
|
66
|
-
Accepts a path to a file or directory to search up for a `tsconfig.json` file.
|
|
67
|
-
|
|
68
|
-
#### configName
|
|
69
|
-
Type: `string`
|
|
70
|
-
|
|
71
|
-
Default: `tsconfig.json`
|
|
72
|
-
|
|
73
|
-
The file name of the TypeScript config file.
|
|
74
|
-
|
|
75
|
-
#### cache
|
|
76
|
-
Type: `Map<string, any>`
|
|
77
|
-
|
|
78
|
-
Default: `new Map()`
|
|
79
|
-
|
|
80
|
-
Optional cache for fs operations.
|
|
81
|
-
|
|
82
|
-
#### Example
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
import { getTsconfig } from 'get-tsconfig'
|
|
86
|
-
|
|
87
|
-
// Searches for tsconfig.json starting in the current directory
|
|
88
|
-
console.log(getTsconfig())
|
|
89
|
-
|
|
90
|
-
// Find tsconfig.json from a TypeScript file path
|
|
91
|
-
console.log(getTsconfig('./path/to/index.ts'))
|
|
92
|
-
|
|
93
|
-
// Find tsconfig.json from a directory file path
|
|
94
|
-
console.log(getTsconfig('./path/to/directory'))
|
|
95
|
-
|
|
96
|
-
// Explicitly pass in tsconfig.json path
|
|
97
|
-
console.log(getTsconfig('./path/to/tsconfig.json'))
|
|
98
|
-
|
|
99
|
-
// Search for jsconfig.json - https://code.visualstudio.com/docs/languages/jsconfig
|
|
100
|
-
console.log(getTsconfig('.', 'jsconfig.json'))
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
### parseTsconfig(tsconfigPath, cache?)
|
|
106
|
-
|
|
107
|
-
Parse the tsconfig file provided. Used internally by `getTsconfig`. Returns the parsed tsconfig as `TsConfigJsonResolved`.
|
|
108
|
-
|
|
109
|
-
#### tsconfigPath
|
|
110
|
-
Type: `string`
|
|
111
|
-
|
|
112
|
-
Required path to the tsconfig file.
|
|
113
|
-
|
|
114
|
-
#### cache
|
|
115
|
-
Type: `Map<string, any>`
|
|
116
|
-
|
|
117
|
-
Default: `new Map()`
|
|
118
|
-
|
|
119
|
-
Optional cache for fs operations.
|
|
120
|
-
|
|
121
|
-
#### Example
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
import { parseTsconfig } from 'get-tsconfig'
|
|
125
|
-
|
|
126
|
-
// Must pass in a path to an existing tsconfig.json file
|
|
127
|
-
console.log(parseTsconfig('./path/to/tsconfig.custom.json'))
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
### createFileMatcher(tsconfig: TsconfigResult, caseSensitivePaths?: boolean)
|
|
133
|
-
|
|
134
|
-
Given a `tsconfig.json` file, it returns a file-matcher function that determines whether it should apply to a file path.
|
|
135
|
-
|
|
136
|
-
```ts
|
|
137
|
-
type FileMatcher = (filePath: string) => TsconfigResult['config'] | undefined
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### tsconfig
|
|
141
|
-
Type: `TsconfigResult`
|
|
142
|
-
|
|
143
|
-
Pass in the return value from `getTsconfig`, or a `TsconfigResult` object.
|
|
144
|
-
|
|
145
|
-
#### caseSensitivePaths
|
|
146
|
-
Type: `boolean`
|
|
147
|
-
|
|
148
|
-
By default, it uses [`is-fs-case-sensitive`](https://github.com/privatenumber/is-fs-case-sensitive) to detect whether the file-system is case-sensitive.
|
|
149
|
-
|
|
150
|
-
Pass in `true` to make it case-sensitive.
|
|
151
|
-
|
|
152
|
-
#### Example
|
|
153
|
-
|
|
154
|
-
For example, if it's called with a `tsconfig.json` file that has `include`/`exclude`/`files` defined, the file-matcher will return the config for files that match `include`/`files`, and return `undefined` for files that don't match or match `exclude`.
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
const tsconfig = getTsconfig()
|
|
158
|
-
const fileMatcher = tsconfig && createFileMatcher(tsconfig)
|
|
159
|
-
|
|
160
|
-
/*
|
|
161
|
-
* Returns tsconfig.json if it matches the file,
|
|
162
|
-
* undefined if not
|
|
163
|
-
*/
|
|
164
|
-
const configForFile = fileMatcher?.('/path/to/file.ts')
|
|
165
|
-
const distCode = compileTypescript({
|
|
166
|
-
code: sourceCode,
|
|
167
|
-
tsconfig: configForFile
|
|
168
|
-
})
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
### createPathsMatcher(tsconfig: TsconfigResult)
|
|
174
|
-
|
|
175
|
-
Given a tsconfig with [`compilerOptions.paths`](https://www.typescriptlang.org/tsconfig#paths) defined, it returns a matcher function.
|
|
176
|
-
|
|
177
|
-
The matcher function accepts an [import specifier (the path to resolve)](https://nodejs.org/api/esm.html#terminology), checks it against `compilerOptions.paths`, and returns an array of possible paths to check:
|
|
178
|
-
```ts
|
|
179
|
-
function pathsMatcher(specifier: string): string[]
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
This function only returns possible paths and doesn't actually do any resolution. This helps increase compatibility wtih file/build systems which usually have their own resolvers.
|
|
183
|
-
|
|
184
|
-
#### Example
|
|
185
|
-
|
|
186
|
-
```ts
|
|
187
|
-
import { getTsconfig, createPathsMatcher } from 'get-tsconfig'
|
|
188
|
-
|
|
189
|
-
const tsconfig = getTsconfig()
|
|
190
|
-
const pathsMatcher = createPathsMatcher(tsconfig)
|
|
191
|
-
|
|
192
|
-
const exampleResolver = (request: string) => {
|
|
193
|
-
if (pathsMatcher) {
|
|
194
|
-
const tryPaths = pathsMatcher(request)
|
|
195
|
-
|
|
196
|
-
// Check if paths in `tryPaths` exist
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## FAQ
|
|
202
|
-
|
|
203
|
-
### How can I use TypeScript to parse `tsconfig.json`?
|
|
204
|
-
This package is a re-implementation of TypeScript's `tsconfig.json` parser.
|
|
205
|
-
|
|
206
|
-
However, if you already have TypeScript as a dependency, you can simply use it's API:
|
|
207
|
-
|
|
208
|
-
```ts
|
|
209
|
-
import {
|
|
210
|
-
sys as tsSys,
|
|
211
|
-
findConfigFile,
|
|
212
|
-
readConfigFile,
|
|
213
|
-
parseJsonConfigFileContent
|
|
214
|
-
} from 'typescript'
|
|
215
|
-
|
|
216
|
-
// Find tsconfig.json file
|
|
217
|
-
const tsconfigPath = findConfigFile(process.cwd(), tsSys.fileExists, 'tsconfig.json')
|
|
218
|
-
|
|
219
|
-
// Read tsconfig.json file
|
|
220
|
-
const tsconfigFile = readConfigFile(tsconfigPath, tsSys.readFile)
|
|
221
|
-
|
|
222
|
-
// Resolve extends
|
|
223
|
-
const parsedTsconfig = parseJsonConfigFileContent(
|
|
224
|
-
tsconfigFile.config,
|
|
225
|
-
tsSys,
|
|
226
|
-
path.dirname(tsconfigPath)
|
|
227
|
-
)
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Sponsors
|
|
231
|
-
<p align="center">
|
|
232
|
-
<a href="https://github.com/sponsors/privatenumber">
|
|
233
|
-
<img src="https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg">
|
|
234
|
-
</a>
|
|
235
|
-
</p>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var o=(e,t)=>de(e,"name",{value:t,configurable:!0});var p=require("node:path"),se=require("node:fs"),ve=require("node:module"),Te=require("resolve-pkg-maps"),Ae=require("fs");function E(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}o(E,"slash");const O=o(e=>{const t=se[e];return(s,...n)=>{const l=`${e}:${n.join(":")}`;let i=s==null?void 0:s.get(l);return i===void 0&&(i=Reflect.apply(t,se,n),s==null||s.set(l,i)),i}},"cacheFs"),B=O("existsSync"),_e=O("readFileSync"),M=O("statSync"),le=o((e,t,s)=>{for(;;){const n=p.posix.join(e,t);if(B(s,n))return n;const l=p.dirname(e);if(l===e)return;e=l}},"findUp"),G=/^\.{1,2}(\/.*)?$/,q=o(e=>{const t=E(e);return G.test(t)?t:`./${t}`},"normalizeRelativePath");function je(e,t=!1){const s=e.length;let n=0,l="",i=0,u=16,f=0,r=0,g=0,T=0,b=0;function _(c,k){let m=0,F=0;for(;m<c;){let j=e.charCodeAt(n);if(j>=48&&j<=57)F=F*16+j-48;else if(j>=65&&j<=70)F=F*16+j-65+10;else if(j>=97&&j<=102)F=F*16+j-97+10;else break;n++,m++}return m<c&&(F=-1),F}o(_,"scanHexDigits");function d(c){n=c,l="",i=0,u=16,b=0}o(d,"setPosition");function A(){let c=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&U(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&U(e.charCodeAt(n)))for(n++;n<e.length&&U(e.charCodeAt(n));)n++;else return b=3,e.substring(c,n);let k=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&U(e.charCodeAt(n))){for(n++;n<e.length&&U(e.charCodeAt(n));)n++;k=n}else b=3;return e.substring(c,k)}o(A,"scanNumber");function w(){let c="",k=n;for(;;){if(n>=s){c+=e.substring(k,n),b=2;break}const m=e.charCodeAt(n);if(m===34){c+=e.substring(k,n),n++;break}if(m===92){if(c+=e.substring(k,n),n++,n>=s){b=2;break}switch(e.charCodeAt(n++)){case 34:c+='"';break;case 92:c+="\\";break;case 47:c+="/";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
2
|
-
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:const j=_(4);j>=0?c+=String.fromCharCode(j):b=4;break;default:b=5}k=n;continue}if(m>=0&&m<=31)if(N(m)){c+=e.substring(k,n),b=2;break}else b=6;n++}return c}o(w,"scanString");function y(){if(l="",b=0,i=n,r=f,T=g,n>=s)return i=s,u=17;let c=e.charCodeAt(n);if(Q(c)){do n++,l+=String.fromCharCode(c),c=e.charCodeAt(n);while(Q(c));return u=15}if(N(c))return n++,l+=String.fromCharCode(c),c===13&&e.charCodeAt(n)===10&&(n++,l+=`
|
|
3
|
-
`),f++,g=n,u=14;switch(c){case 123:return n++,u=1;case 125:return n++,u=2;case 91:return n++,u=3;case 93:return n++,u=4;case 58:return n++,u=6;case 44:return n++,u=5;case 34:return n++,l=w(),u=10;case 47:const k=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<s&&!N(e.charCodeAt(n));)n++;return l=e.substring(k,n),u=12}if(e.charCodeAt(n+1)===42){n+=2;const m=s-1;let F=!1;for(;n<m;){const j=e.charCodeAt(n);if(j===42&&e.charCodeAt(n+1)===47){n+=2,F=!0;break}n++,N(j)&&(j===13&&e.charCodeAt(n)===10&&n++,f++,g=n)}return F||(n++,b=1),l=e.substring(k,n),u=13}return l+=String.fromCharCode(c),n++,u=16;case 45:if(l+=String.fromCharCode(c),n++,n===s||!U(e.charCodeAt(n)))return u=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return l+=A(),u=11;default:for(;n<s&&I(c);)n++,c=e.charCodeAt(n);if(i!==n){switch(l=e.substring(i,n),l){case"true":return u=8;case"false":return u=9;case"null":return u=7}return u=16}return l+=String.fromCharCode(c),n++,u=16}}o(y,"scanNext");function I(c){if(Q(c)||N(c))return!1;switch(c){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}o(I,"isUnknownContentCharacter");function L(){let c;do c=y();while(c>=12&&c<=15);return c}return o(L,"scanNextNonTrivia"),{setPosition:d,getPosition:o(()=>n,"getPosition"),scan:t?L:y,getToken:o(()=>u,"getToken"),getTokenValue:o(()=>l,"getTokenValue"),getTokenOffset:o(()=>i,"getTokenOffset"),getTokenLength:o(()=>n-i,"getTokenLength"),getTokenStartLine:o(()=>r,"getTokenStartLine"),getTokenStartCharacter:o(()=>i-T,"getTokenStartCharacter"),getTokenError:o(()=>b,"getTokenError")}}o(je,"createScanner");function Q(e){return e===32||e===9}o(Q,"isWhiteSpace");function N(e){return e===10||e===13}o(N,"isLineBreak");function U(e){return e>=48&&e<=57}o(U,"isDigit");var ie;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(ie||(ie={})),new Array(20).fill(0).map((e,t)=>" ".repeat(t));const x=200;new Array(x).fill(0).map((e,t)=>`
|
|
4
|
-
`+" ".repeat(t)),new Array(x).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(x).fill(0).map((e,t)=>`\r
|
|
5
|
-
`+" ".repeat(t)),new Array(x).fill(0).map((e,t)=>`
|
|
6
|
-
`+" ".repeat(t)),new Array(x).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(x).fill(0).map((e,t)=>`\r
|
|
7
|
-
`+" ".repeat(t));var W;(function(e){e.DEFAULT={allowTrailingComma:!1}})(W||(W={}));function ye(e,t=[],s=W.DEFAULT){let n=null,l=[];const i=[];function u(r){Array.isArray(l)?l.push(r):n!==null&&(l[n]=r)}return o(u,"onValue"),Fe(e,{onObjectBegin:o(()=>{const r={};u(r),i.push(l),l=r,n=null},"onObjectBegin"),onObjectProperty:o(r=>{n=r},"onObjectProperty"),onObjectEnd:o(()=>{l=i.pop()},"onObjectEnd"),onArrayBegin:o(()=>{const r=[];u(r),i.push(l),l=r,n=null},"onArrayBegin"),onArrayEnd:o(()=>{l=i.pop()},"onArrayEnd"),onLiteralValue:u,onError:o((r,g,T)=>{t.push({error:r,offset:g,length:T})},"onError")},s),l[0]}o(ye,"parse$1");function Fe(e,t,s=W.DEFAULT){const n=je(e,!1),l=[];function i(v){return v?()=>v(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}o(i,"toNoArgVisit");function u(v){return v?()=>v(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>l.slice()):()=>!0}o(u,"toNoArgVisitWithPath");function f(v){return v?D=>v(D,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}o(f,"toOneArgVisit");function r(v){return v?D=>v(D,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>l.slice()):()=>!0}o(r,"toOneArgVisitWithPath");const g=u(t.onObjectBegin),T=r(t.onObjectProperty),b=i(t.onObjectEnd),_=u(t.onArrayBegin),d=i(t.onArrayEnd),A=r(t.onLiteralValue),w=f(t.onSeparator),y=i(t.onComment),I=f(t.onError),L=s&&s.disallowComments,c=s&&s.allowTrailingComma;function k(){for(;;){const v=n.scan();switch(n.getTokenError()){case 4:m(14);break;case 5:m(15);break;case 3:m(13);break;case 1:L||m(11);break;case 2:m(12);break;case 6:m(16);break}switch(v){case 12:case 13:L?m(10):y();break;case 16:m(1);break;case 15:case 14:break;default:return v}}}o(k,"scanNext");function m(v,D=[],te=[]){if(I(v),D.length+te.length>0){let R=n.getToken();for(;R!==17;){if(D.indexOf(R)!==-1){k();break}else if(te.indexOf(R)!==-1)break;R=k()}}}o(m,"handleError");function F(v){const D=n.getTokenValue();return v?A(D):(T(D),l.push(D)),k(),!0}o(F,"parseString");function j(){switch(n.getToken()){case 11:const v=n.getTokenValue();let D=Number(v);isNaN(D)&&(m(2),D=0),A(D);break;case 7:A(null);break;case 8:A(!0);break;case 9:A(!1);break;default:return!1}return k(),!0}o(j,"parseLiteral");function S(){return n.getToken()!==10?(m(3,[],[2,5]),!1):(F(!1),n.getToken()===6?(w(":"),k(),h()||m(4,[],[2,5])):m(5,[],[2,5]),l.pop(),!0)}o(S,"parseProperty");function P(){g(),k();let v=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(v||m(4,[],[]),w(","),k(),n.getToken()===2&&c)break}else v&&m(6,[],[]);S()||m(4,[],[2,5]),v=!0}return b(),n.getToken()!==2?m(7,[2],[]):k(),!0}o(P,"parseObject");function a(){_(),k();let v=!0,D=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(D||m(4,[],[]),w(","),k(),n.getToken()===4&&c)break}else D&&m(6,[],[]);v?(l.push(0),v=!1):l[l.length-1]++,h()||m(4,[],[4,5]),D=!0}return d(),v||l.pop(),n.getToken()!==4?m(8,[4],[]):k(),!0}o(a,"parseArray");function h(){switch(n.getToken()){case 3:return a();case 1:return P();case 10:return F(!0);default:return j()}}return o(h,"parseValue"),k(),n.getToken()===17?s.allowEmptyContent?!0:(m(4,[],[]),!1):h()?(n.getToken()!==17&&m(9,[],[]),!0):(m(4,[],[]),!1)}o(Fe,"visit");var oe;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(oe||(oe={}));var ue;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(ue||(ue={}));const De=ye;var re;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(re||(re={}));const fe=o((e,t)=>De(_e(t,e,"utf8")),"readJsonc"),H=Symbol("implicitBaseUrl"),$="${configDir}",Ee=o(()=>{const{findPnpApi:e}=ve;return e&&e(process.cwd())},"getPnpApi"),X=o((e,t,s,n)=>{const l=`resolveFromPackageJsonPath:${e}:${t}:${s}`;if(n!=null&&n.has(l))return n.get(l);const i=fe(e,n);if(!i)return;let u=t||"tsconfig.json";if(!s&&i.exports)try{const[f]=Te.resolveExports(i.exports,t,["require","types"]);u=f}catch{return!1}else!t&&i.tsconfig&&(u=i.tsconfig);return u=p.join(e,"..",u),n==null||n.set(l,u),u},"resolveFromPackageJsonPath"),Y="package.json",Z="tsconfig.json",Be=o((e,t,s)=>{let n=e;if(e===".."&&(n=p.join(n,Z)),e[0]==="."&&(n=p.resolve(t,n)),p.isAbsolute(n)){if(B(s,n)){if(M(s,n).isFile())return n}else if(!n.endsWith(".json")){const d=`${n}.json`;if(B(s,d))return d}return}const[l,...i]=e.split("/"),u=l[0]==="@"?`${l}/${i.shift()}`:l,f=i.join("/"),r=Ee();if(r){const{resolveRequest:d}=r;try{if(u===e){const A=d(p.join(u,Y),t);if(A){const w=X(A,f,!1,s);if(w&&B(s,w))return w}}else{let A;try{A=d(e,t,{extensions:[".json"]})}catch{A=d(p.join(e,Z),t)}if(A)return A}}catch{}}const g=le(p.resolve(t),p.join("node_modules",u),s);if(!g||!M(s,g).isDirectory())return;const T=p.join(g,Y);if(B(s,T)){const d=X(T,f,!1,s);if(d===!1)return;if(d&&B(s,d)&&M(s,d).isFile())return d}const b=p.join(g,f),_=b.endsWith(".json");if(!_){const d=`${b}.json`;if(B(s,d))return d}if(B(s,b)){if(M(s,b).isDirectory()){const d=p.join(b,Y);if(B(s,d)){const w=X(d,"",!0,s);if(w&&B(s,w))return w}const A=p.join(b,Z);if(B(s,A))return A}else if(_)return b}},"resolveExtendsPath"),K=o((e,t)=>q(p.relative(e,t)),"pathRelative"),ce=["files","include","exclude"],Ie=o((e,t,s,n)=>{const l=Be(e,t,n);if(!l)throw new Error(`File '${e}' not found.`);if(s.has(l))throw new Error(`Circularity detected while resolving configuration: ${l}`);s.add(l);const i=p.dirname(l),u=ae(l,n,s);delete u.references;const{compilerOptions:f}=u;if(f){const{baseUrl:r}=f;r&&!r.startsWith($)&&(f.baseUrl=E(p.relative(t,p.join(i,r)))||"./");let{outDir:g}=f;g&&(g.startsWith($)||(g=p.relative(t,p.join(i,g))),f.outDir=E(g)||"./")}for(const r of ce){const g=u[r];g&&(u[r]=g.map(T=>T.startsWith($)?T:E(p.relative(t,p.join(i,T)))))}return u},"resolveExtends"),Le=["outDir","declarationDir"],ae=o((e,t,s=new Set)=>{let n;try{n=fe(e,t)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof n!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const l=p.dirname(e);if(n.compilerOptions){const{compilerOptions:i}=n;i.paths&&!i.baseUrl&&(i[H]=l)}if(n.extends){const i=Array.isArray(n.extends)?n.extends:[n.extends];delete n.extends;for(const u of i.reverse()){const f=Ie(u,l,new Set(s),t),r={...f,...n,compilerOptions:{...f.compilerOptions,...n.compilerOptions}};f.watchOptions&&(r.watchOptions={...f.watchOptions,...n.watchOptions}),n=r}}if(n.compilerOptions){const{compilerOptions:i}=n,u=["baseUrl","rootDir"];for(const f of u){const r=i[f];if(r&&!r.startsWith($)){const g=p.resolve(l,r),T=K(l,g);i[f]=T}}for(const f of Le){let r=i[f];r&&(Array.isArray(n.exclude)||(n.exclude=[]),n.exclude.includes(r)||n.exclude.push(r),r.startsWith($)||(r=q(r)),i[f]=r)}}else n.compilerOptions={};if(n.include?(n.include=n.include.map(E),n.files&&delete n.files):n.files&&(n.files=n.files.map(i=>i.startsWith($)?i:q(i))),n.watchOptions){const{watchOptions:i}=n;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(u=>E(p.resolve(l,u))))}return n},"_parseTsconfig"),V=o((e,t)=>{if(e.startsWith($))return E(p.join(t,e.slice($.length)))},"interpolateConfigDir"),$e=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],he=o(e=>{var t,s,n,l,i,u,f,r,g,T,b,_,d,A,w,y,I,L,c,k,m,F,j,S,P;if(e.strict){const a=["noImplicitAny","noImplicitThis","strictNullChecks","strictFunctionTypes","strictBindCallApply","strictPropertyInitialization","strictBuiltinIteratorReturn","alwaysStrict","useUnknownInCatchVariables"];for(const h of a)e[h]===void 0&&(e[h]=!0)}if(e.target){let a=e.target.toLowerCase();a==="es2015"&&(a="es6"),e.target=a,a==="esnext"&&((t=e.module)!=null||(e.module="es6"),(s=e.moduleResolution)!=null||(e.moduleResolution="classic"),(n=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0)),(a==="es6"||a==="es2016"||a==="es2017"||a==="es2018"||a==="es2019"||a==="es2020"||a==="es2021"||a==="es2022"||a==="es2023"||a==="es2024")&&((l=e.module)!=null||(e.module="es6"),(i=e.moduleResolution)!=null||(e.moduleResolution="classic")),(a==="es2022"||a==="es2023"||a==="es2024")&&((u=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0))}if(e.module){let a=e.module.toLowerCase();a==="es2015"&&(a="es6"),e.module=a,(a==="es6"||a==="es2020"||a==="es2022"||a==="esnext"||a==="none"||a==="system"||a==="umd"||a==="amd")&&((f=e.moduleResolution)!=null||(e.moduleResolution="classic")),a==="system"&&((r=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),(a==="node16"||a==="nodenext"||a==="preserve")&&((g=e.esModuleInterop)!=null||(e.esModuleInterop=!0),(T=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),(a==="node16"||a==="nodenext")&&((b=e.moduleDetection)!=null||(e.moduleDetection="force"),(_=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0)),a==="node16"&&((d=e.target)!=null||(e.target="es2022"),(A=e.moduleResolution)!=null||(e.moduleResolution="node16")),a==="nodenext"&&((w=e.target)!=null||(e.target="esnext"),(y=e.moduleResolution)!=null||(e.moduleResolution="nodenext")),a==="preserve"&&((I=e.moduleResolution)!=null||(e.moduleResolution="bundler"))}if(e.moduleResolution){let a=e.moduleResolution.toLowerCase();a==="node"&&(a="node10"),e.moduleResolution=a,(a==="node16"||a==="nodenext"||a==="bundler")&&((L=e.resolvePackageJsonExports)!=null||(e.resolvePackageJsonExports=!0),(c=e.resolvePackageJsonImports)!=null||(e.resolvePackageJsonImports=!0)),a==="bundler"&&((k=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0),(m=e.resolveJsonModule)!=null||(e.resolveJsonModule=!0))}e.esModuleInterop&&((F=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),e.verbatimModuleSyntax&&((j=e.isolatedModules)!=null||(e.isolatedModules=!0),(S=e.preserveConstEnums)!=null||(e.preserveConstEnums=!0)),e.isolatedModules&&((P=e.preserveConstEnums)!=null||(e.preserveConstEnums=!0))},"normalizeCompilerOptions"),ge=o((e,t=new Map)=>{const s=p.resolve(e),n=ae(s,t),l=p.dirname(s),{compilerOptions:i}=n;if(i){for(const f of $e){const r=i[f];if(r){const g=V(r,l);i[f]=g?K(l,g):r}}for(const f of["rootDirs","typeRoots"]){const r=i[f];r&&(i[f]=r.map(g=>{const T=V(g,l);return T?K(l,T):g}))}const{paths:u}=i;if(u)for(const f of Object.keys(u))u[f]=u[f].map(r=>{var g;return(g=V(r,l))!=null?g:r});he(i)}for(const u of ce){const f=n[u];f&&(n[u]=f.map(r=>{var g;return(g=V(r,l))!=null?g:r}))}return n},"parseTsconfig"),Ue=o((e=process.cwd(),t="tsconfig.json",s=new Map)=>{const n=le(E(e),t,s);if(!n)return null;const l=ge(n,s);return{path:n,config:l}},"getTsconfig"),xe=/\*/g,me=o((e,t)=>{const s=e.match(xe);if(s&&s.length>1)throw new Error(t)},"assertStarCount"),Ne=o(e=>{if(e.includes("*")){const[t,s]=e.split("*");return{prefix:t,suffix:s}}return e},"parsePattern"),Se=o(({prefix:e,suffix:t},s)=>s.startsWith(e)&&s.endsWith(t),"isPatternMatch"),Pe=o((e,t,s)=>Object.entries(e).map(([n,l])=>(me(n,`Pattern '${n}' can have at most one '*' character.`),{pattern:Ne(n),substitutions:l.map(i=>{if(me(i,`Substitution '${i}' in pattern '${n}' can have at most one '*' character.`),!t&&!G.test(i))throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");return p.resolve(s,i)})})),"parsePaths"),Re=o(e=>{const{compilerOptions:t}=e.config;if(!t)return null;const{baseUrl:s,paths:n}=t;if(!s&&!n)return null;const l=H in t&&t[H],i=p.resolve(p.dirname(e.path),s||l||"."),u=n?Pe(n,s,i):[];return f=>{if(G.test(f))return[];const r=[];for(const _ of u){if(_.pattern===f)return _.substitutions.map(E);typeof _.pattern!="string"&&r.push(_)}let g,T=-1;for(const _ of r)Se(_.pattern,f)&&_.pattern.prefix.length>T&&(T=_.pattern.prefix.length,g=_);if(!g)return s?[E(p.join(i,f))]:[];const b=f.slice(g.pattern.prefix.length,f.length-g.pattern.suffix.length);return g.substitutions.map(_=>E(_.replace("*",b)))}},"createPathsMatcher"),pe=o(e=>{let t="";for(let s=0;s<e.length;s+=1){const n=e[s],l=n.toUpperCase();t+=n===l?n.toLowerCase():l}return t},"s"),Me=65,We=97,Ve=o(()=>Math.floor(Math.random()*26),"m"),Je=o(e=>Array.from({length:e},()=>String.fromCodePoint(Ve()+(Math.random()>.5?Me:We))).join(""),"S"),ze=o((e=Ae)=>{const t=process.execPath;if(e.existsSync(t))return!e.existsSync(pe(t));const s=`/${Je(10)}`;e.writeFileSync(s,"");const n=!e.existsSync(pe(s));return e.unlinkSync(s),n},"l"),{join:J}=p.posix,C={ts:[".ts",".tsx",".d.ts"],cts:[".cts",".d.cts"],mts:[".mts",".d.mts"]},Oe=o(e=>{const t=[...C.ts],s=[...C.cts],n=[...C.mts];return e!=null&&e.allowJs&&(t.push(".js",".jsx"),s.push(".cjs"),n.push(".mjs")),[...t,...s,...n]},"getSupportedExtensions"),Ge=o(e=>{const t=[];if(!e)return t;const{outDir:s,declarationDir:n}=e;return s&&t.push(s),n&&t.push(n),t},"getDefaultExcludeSpec"),ke=o(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeForRegexp"),qe=["node_modules","bower_components","jspm_packages"],ee=`(?!(${qe.join("|")})(/|$))`,Qe=/(?:^|\/)[^.*?]+$/,we="**/*",z="[^/]",ne="[^./]",be=process.platform==="win32",He=o(({config:e,path:t},s=ze())=>{if("extends"in e)throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it.");if(!p.isAbsolute(t))throw new Error("The tsconfig path must be absolute");be&&(t=E(t));const n=p.dirname(t),{files:l,include:i,exclude:u,compilerOptions:f}=e,r=l==null?void 0:l.map(w=>J(n,w)),g=Oe(f),T=s?"":"i",_=(u||Ge(f)).map(w=>{const y=J(n,w),I=ke(y).replaceAll(String.raw`\*\*/`,"(.+/)?").replaceAll(String.raw`\*`,`${z}*`).replaceAll(String.raw`\?`,z);return new RegExp(`^${I}($|/)`,T)}),d=l||i?i:[we],A=d?d.map(w=>{let y=J(n,w);Qe.test(y)&&(y=J(y,we));const I=ke(y).replaceAll(String.raw`/\*\*`,`(/${ee}${ne}${z}*)*?`).replaceAll(/(\/)?\\\*/g,(L,c)=>{const k=`(${ne}|(\\.(?!min\\.js$))?)*`;return c?`/${ee}${ne}${k}`:k}).replaceAll(/(\/)?\\\?/g,(L,c)=>{const k=z;return c?`/${ee}${k}`:k});return new RegExp(`^${I}$`,T)}):void 0;return w=>{if(!p.isAbsolute(w))throw new Error("filePath must be absolute");if(be&&(w=E(w)),r!=null&&r.includes(w))return e;if(!(!g.some(y=>w.endsWith(y))||_.some(y=>y.test(w)))&&A&&A.some(y=>y.test(w)))return e}},"createFilesMatcher");exports.createFilesMatcher=He,exports.createPathsMatcher=Re,exports.getTsconfig=Ue,exports.parseTsconfig=ge;
|