powerlines 0.23.10 → 0.24.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.
- package/dist/{api-5H3zEedD.d.ts → api-C32Buv5_.d.ts} +1 -1
- package/dist/{api-B77aqxGC.d.cts → api-wzd5AREv.d.cts} +1 -1
- package/dist/api.cjs +2 -2
- package/dist/api.d.cts +4 -2
- package/dist/api.d.ts +4 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.d.cts +3 -1
- package/dist/astro.d.ts +3 -1
- package/dist/astro.js +3 -3
- package/dist/chunk-2TWFBWKA.cjs +133 -0
- package/dist/{chunk-3W5CN3M3.js → chunk-7V3LWCLB.js} +1 -1
- package/dist/chunk-EXQM3KGH.js +130 -0
- package/dist/{chunk-4EIGDACJ.cjs → chunk-FGH3MZTQ.cjs} +523 -649
- package/dist/{chunk-SNHUEYEP.cjs → chunk-FPB2O7FD.cjs} +2 -2
- package/dist/{chunk-ZIWN73GA.js → chunk-H74SWU2C.js} +1 -1
- package/dist/{chunk-WBC2XOMT.cjs → chunk-HTGCHSLH.cjs} +2 -2
- package/dist/{chunk-PR3JGGAL.cjs → chunk-TIBYAWZZ.cjs} +2 -2
- package/dist/{chunk-SS5AXCGJ.js → chunk-ZEE73BCY.js} +1 -1
- package/dist/{chunk-MUNYXQYT.js → chunk-ZT2J55YE.js} +526 -649
- package/dist/config.d.cts +3 -1
- package/dist/config.d.ts +3 -1
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.d.cts +3 -1
- package/dist/esbuild.d.ts +3 -1
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.d.cts +3 -1
- package/dist/farm.d.ts +3 -1
- package/dist/farm.js +2 -2
- package/dist/index.cjs +11 -23
- package/dist/index.d.cts +6 -135
- package/dist/index.d.ts +6 -135
- package/dist/index.js +2 -2
- package/dist/lib/{api-Cm51oVbC.d.cts → api-BRMITKt-.d.cts} +1 -1
- package/dist/lib/{api-mja4jirh.d.ts → api-CDUN9en8.d.ts} +1 -1
- package/dist/lib/build/esbuild.d.cts +3 -1
- package/dist/lib/build/esbuild.d.ts +3 -1
- package/dist/lib/build/index.d.cts +5 -3
- package/dist/lib/build/index.d.ts +5 -3
- package/dist/lib/build/rolldown.d.cts +3 -1
- package/dist/lib/build/rolldown.d.ts +3 -1
- package/dist/lib/build/rollup.d.cts +3 -1
- package/dist/lib/build/rollup.d.ts +3 -1
- package/dist/lib/build/rspack.d.cts +3 -1
- package/dist/lib/build/rspack.d.ts +3 -1
- package/dist/lib/build/tsup.d.cts +3 -1
- package/dist/lib/build/tsup.d.ts +3 -1
- package/dist/lib/build/unbuild.d.cts +5 -3
- package/dist/lib/build/unbuild.d.ts +5 -3
- package/dist/lib/build/vite.d.cts +3 -1
- package/dist/lib/build/vite.d.ts +3 -1
- package/dist/lib/build/webpack.d.cts +3 -1
- package/dist/lib/build/webpack.d.ts +3 -1
- package/dist/lib/{chunk-52VDUP5J.js → chunk-6I5PL7H2.js} +5 -17
- package/dist/lib/{chunk-UPVFKXB7.cjs → chunk-6PPZCPME.cjs} +1 -2
- package/dist/lib/{chunk-HNOAMIRO.js → chunk-7CVPZOH4.js} +2 -2
- package/dist/lib/{chunk-SEWUUTNA.js → chunk-A2NFSQ5K.js} +1 -1
- package/dist/lib/{chunk-I6TJUFA6.cjs → chunk-AA6RBP44.cjs} +10 -10
- package/dist/lib/{chunk-VDPCG3RR.js → chunk-CGRHZJY5.js} +41 -82
- package/dist/lib/{chunk-OJ5XFCZN.js → chunk-DFW5FGEO.js} +1 -1
- package/dist/lib/{chunk-VL63QEPF.cjs → chunk-DUZJ7ZF2.cjs} +2 -2
- package/dist/lib/{chunk-EFYMNU53.cjs → chunk-EV357RFB.cjs} +5 -17
- package/dist/lib/{chunk-54XNJQTH.js → chunk-HAXL7QE7.js} +3 -3
- package/dist/lib/{chunk-XG4CC73V.js → chunk-KFWMKDJQ.js} +391 -589
- package/dist/lib/{chunk-RBSNQFLF.cjs → chunk-MS3CD2U6.cjs} +49 -91
- package/dist/lib/{chunk-QABAD5RE.cjs → chunk-RNHKEPFD.cjs} +387 -586
- package/dist/lib/{chunk-4EIXDLFP.cjs → chunk-SAS5EPBD.cjs} +7 -5
- package/dist/lib/{chunk-EUDKQWSB.js → chunk-VHLINWXG.js} +1 -2
- package/dist/lib/{chunk-VLOUSKRX.cjs → chunk-VMLQATMA.cjs} +4 -4
- package/dist/lib/{chunk-IBPA3VN5.cjs → chunk-WUYK74EH.cjs} +3 -3
- package/dist/lib/{chunk-RD5AUWXN.js → chunk-YQ3ODCHV.js} +7 -5
- package/dist/lib/{config-BnJpgcGr.d.cts → config-D8KrE7SZ.d.cts} +109 -35
- package/dist/lib/{config-7Q2dBjJE.d.ts → config-DBIFdRoq.d.ts} +109 -35
- package/dist/lib/config-file.d.cts +3 -1
- package/dist/lib/config-file.d.ts +3 -1
- package/dist/lib/contexts/api-context.cjs +5 -4
- package/dist/lib/contexts/api-context.d.cts +5 -3
- package/dist/lib/contexts/api-context.d.ts +5 -3
- package/dist/lib/contexts/api-context.js +4 -3
- package/dist/lib/contexts/context.cjs +3 -2
- package/dist/lib/contexts/context.d.cts +47 -4
- package/dist/lib/contexts/context.d.ts +47 -4
- package/dist/lib/contexts/context.js +2 -1
- package/dist/lib/contexts/environment-context.cjs +4 -3
- package/dist/lib/contexts/environment-context.d.cts +5 -3
- package/dist/lib/contexts/environment-context.d.ts +5 -3
- package/dist/lib/contexts/environment-context.js +3 -2
- package/dist/lib/contexts/index.cjs +7 -6
- package/dist/lib/contexts/index.d.cts +5 -3
- package/dist/lib/contexts/index.d.ts +5 -3
- package/dist/lib/contexts/index.js +4 -3
- package/dist/lib/contexts/plugin-context.d.cts +5 -3
- package/dist/lib/contexts/plugin-context.d.ts +5 -3
- package/dist/lib/entry.d.cts +3 -1
- package/dist/lib/entry.d.ts +3 -1
- package/dist/lib/index.cjs +39 -45
- package/dist/lib/index.d.cts +67 -48
- package/dist/lib/index.d.ts +67 -48
- package/dist/lib/index.js +12 -14
- package/dist/lib/{internal-BEygquYh.d.ts → internal-1qCyw7bA.d.ts} +2 -2
- package/dist/lib/{internal-BeR8fOB1.d.cts → internal-CaGANOWK.d.cts} +2 -2
- package/dist/lib/logger.d.cts +3 -1
- package/dist/lib/logger.d.ts +3 -1
- package/dist/lib/typescript/compiler-host.cjs +7 -7
- package/dist/lib/typescript/compiler-host.d.cts +3 -1
- package/dist/lib/typescript/compiler-host.d.ts +3 -1
- package/dist/lib/typescript/compiler-host.js +6 -6
- package/dist/lib/typescript/import-transformer.cjs +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +3 -1
- package/dist/lib/typescript/import-transformer.d.ts +3 -1
- package/dist/lib/typescript/import-transformer.js +1 -1
- package/dist/lib/typescript/index.cjs +8 -8
- package/dist/lib/typescript/index.d.cts +3 -2
- package/dist/lib/typescript/index.d.ts +3 -2
- package/dist/lib/typescript/index.js +2 -2
- package/dist/lib/typescript/program.cjs +6 -6
- package/dist/lib/typescript/program.d.cts +3 -1
- package/dist/lib/typescript/program.d.ts +3 -1
- package/dist/lib/typescript/program.js +1 -1
- package/dist/lib/typescript/ts-morph.cjs +2 -2
- package/dist/lib/typescript/ts-morph.d.cts +5 -3
- package/dist/lib/typescript/ts-morph.d.ts +5 -3
- package/dist/lib/typescript/ts-morph.js +1 -1
- package/dist/lib/unplugin/factory.cjs +6 -6
- package/dist/lib/unplugin/factory.d.cts +5 -3
- package/dist/lib/unplugin/factory.d.ts +5 -3
- package/dist/lib/unplugin/factory.js +5 -5
- package/dist/lib/unplugin/helpers.d.cts +3 -1
- package/dist/lib/unplugin/helpers.d.ts +3 -1
- package/dist/lib/unplugin/index.cjs +11 -11
- package/dist/lib/unplugin/index.d.cts +6 -4
- package/dist/lib/unplugin/index.d.ts +6 -4
- package/dist/lib/unplugin/index.js +7 -7
- package/dist/lib/unplugin/plugin.cjs +2 -3
- package/dist/lib/unplugin/plugin.d.cts +6 -4
- package/dist/lib/unplugin/plugin.d.ts +6 -4
- package/dist/lib/unplugin/plugin.js +1 -2
- package/dist/lib/{unplugin-CbbNDduM.d.ts → unplugin-CEeJqADD.d.ts} +2 -2
- package/dist/lib/{unplugin-ppAOzR__.d.cts → unplugin-bUSyjd0S.d.cts} +2 -2
- package/dist/lib/utilities/bundle.cjs +2 -3
- package/dist/lib/utilities/bundle.d.cts +3 -1
- package/dist/lib/utilities/bundle.d.ts +3 -1
- package/dist/lib/utilities/bundle.js +1 -2
- package/dist/lib/utilities/cache.d.cts +3 -1
- package/dist/lib/utilities/cache.d.ts +3 -1
- package/dist/lib/utilities/file-header.d.cts +3 -1
- package/dist/lib/utilities/file-header.d.ts +3 -1
- package/dist/lib/utilities/index.cjs +14 -19
- package/dist/lib/utilities/index.d.cts +3 -2
- package/dist/lib/utilities/index.d.ts +3 -2
- package/dist/lib/utilities/index.js +4 -5
- package/dist/lib/utilities/meta.d.cts +3 -1
- package/dist/lib/utilities/meta.d.ts +3 -1
- package/dist/lib/utilities/resolve.cjs +3 -4
- package/dist/lib/utilities/resolve.d.cts +3 -1
- package/dist/lib/utilities/resolve.d.ts +3 -1
- package/dist/lib/utilities/resolve.js +2 -3
- package/dist/lib/utilities/source-file.d.cts +3 -1
- package/dist/lib/utilities/source-file.d.ts +3 -1
- package/dist/lib/utilities/source-map.d.cts +3 -1
- package/dist/lib/utilities/source-map.d.ts +3 -1
- package/dist/lib/utilities/worker.d.cts +3 -1
- package/dist/lib/utilities/worker.d.ts +3 -1
- package/dist/lib/utilities/write-file.d.cts +3 -1
- package/dist/lib/utilities/write-file.d.ts +3 -1
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +6 -6
- package/dist/nuxt.js +4 -4
- package/dist/plugin-utils/{context-Cg11S-CE.d.cts → context-BITGF5LZ.d.cts} +118 -39
- package/dist/plugin-utils/{context-Cg11S-CE.d.ts → context-BITGF5LZ.d.ts} +118 -39
- package/dist/plugin-utils/context-helpers.d.cts +4 -1
- package/dist/plugin-utils/context-helpers.d.ts +4 -1
- package/dist/plugin-utils/enforce.d.cts +4 -1
- package/dist/plugin-utils/enforce.d.ts +4 -1
- package/dist/plugin-utils/extend.d.cts +4 -1
- package/dist/plugin-utils/extend.d.ts +4 -1
- package/dist/plugin-utils/get-config-path.d.cts +4 -1
- package/dist/plugin-utils/get-config-path.d.ts +4 -1
- package/dist/plugin-utils/helpers.d.cts +4 -1
- package/dist/plugin-utils/helpers.d.ts +4 -1
- package/dist/plugin-utils/index.d.cts +4 -1
- package/dist/plugin-utils/index.d.ts +4 -1
- package/dist/plugin-utils/merge.d.cts +4 -1
- package/dist/plugin-utils/merge.d.ts +4 -1
- package/dist/plugin-utils/paths.d.cts +4 -1
- package/dist/plugin-utils/paths.d.ts +4 -1
- package/dist/{resolved-B3BSdXCt.d.ts → resolved-BABoCnXm.d.ts} +43 -1
- package/dist/{resolved-DGrpILrS.d.cts → resolved-CSqGKlA5.d.cts} +43 -1
- package/dist/rolldown.cjs +3 -3
- package/dist/rolldown.d.cts +3 -1
- package/dist/rolldown.d.ts +3 -1
- package/dist/rolldown.js +2 -2
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +3 -1
- package/dist/rollup.d.ts +3 -1
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.d.cts +3 -1
- package/dist/rspack.d.ts +3 -1
- package/dist/rspack.js +2 -2
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/types/api.d.cts +4 -2
- package/dist/types/api.d.ts +4 -2
- package/dist/types/babel.d.cts +3 -1
- package/dist/types/babel.d.ts +3 -1
- package/dist/types/commands.d.cts +3 -1
- package/dist/types/commands.d.ts +3 -1
- package/dist/types/config.d.cts +3 -1
- package/dist/types/config.d.ts +3 -1
- package/dist/types/context.d.cts +3 -1
- package/dist/types/context.d.ts +3 -1
- package/dist/types/fs.d.cts +68 -36
- package/dist/types/fs.d.ts +68 -36
- package/dist/types/hooks.d.cts +3 -1
- package/dist/types/hooks.d.ts +3 -1
- package/dist/types/index.d.cts +5 -3
- package/dist/types/index.d.ts +5 -3
- package/dist/types/internal.d.cts +4 -2
- package/dist/types/internal.d.ts +4 -2
- package/dist/types/plugin.d.cts +3 -1
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/resolved.d.cts +3 -1
- package/dist/types/resolved.d.ts +3 -1
- package/dist/types/unplugin.d.cts +4 -2
- package/dist/types/unplugin.d.ts +4 -2
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.d.cts +3 -1
- package/dist/unloader.d.ts +3 -1
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +12 -28
- package/dist/unplugin.d.cts +104 -31
- package/dist/unplugin.d.ts +104 -31
- package/dist/unplugin.js +10 -23
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.cts +3 -1
- package/dist/vite.d.ts +3 -1
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.d.cts +3 -1
- package/dist/webpack.d.ts +3 -1
- package/dist/webpack.js +3 -3
- package/package.json +16 -15
- package/schemas/fs.capnp +35 -38
- package/dist/chunk-4TBQYHPZ.cjs +0 -234
- package/dist/chunk-7G7OFGGH.js +0 -230
- package/dist/lib/chunk-G7S5PIAC.js +0 -89
- package/dist/lib/chunk-MZJWK36Q.cjs +0 -37
- package/dist/lib/chunk-NWAD7K4D.js +0 -35
- package/dist/lib/chunk-ZBDVQVUK.cjs +0 -91
- package/dist/lib/unplugin/resolve-id.cjs +0 -11
- package/dist/lib/unplugin/resolve-id.d.cts +0 -57
- package/dist/lib/unplugin/resolve-id.d.ts +0 -57
- package/dist/lib/unplugin/resolve-id.js +0 -2
- package/dist/lib/utilities/resolve-path.cjs +0 -11
- package/dist/lib/utilities/resolve-path.d.cts +0 -40
- package/dist/lib/utilities/resolve-path.d.ts +0 -40
- package/dist/lib/utilities/resolve-path.js +0 -2
- /package/dist/lib/{chunk-HMO3LAYL.js → chunk-I2DQRMX3.js} +0 -0
- /package/dist/lib/{chunk-EJ25PQEL.cjs → chunk-YK4PYVLM.cjs} +0 -0
package/dist/lib/index.d.cts
CHANGED
|
@@ -4,22 +4,22 @@ export { PowerlinesContext } from './contexts/context.cjs';
|
|
|
4
4
|
export { PowerlinesEnvironmentContext } from './contexts/environment-context.cjs';
|
|
5
5
|
export { createPluginContext } from './contexts/plugin-context.cjs';
|
|
6
6
|
export { getUniqueEntries, resolveEntries, resolveEntriesSync, resolveEntry, resolveEntryInput, resolveEntryInputFile, resolveEntryOutput, resolveVirtualEntry } from './entry.cjs';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { FlatCache } from 'flat-cache';
|
|
8
|
+
import fs, { ObjectEncodingOptions, Stats, StatSyncOptions } from 'node:fs';
|
|
9
|
+
import { V as VirtualFileSystemInterface, C as Context, a as VirtualFileMetadata, R as ResolveOptions, b as ResolveFSOptions, M as MakeDirectoryOptions, W as WriteFileData, c as WriteFileOptions, _ as __VFS_PATCH__, d as __VFS_REVERT__ } from './config-D8KrE7SZ.cjs';
|
|
9
10
|
export { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from './logger.cjs';
|
|
10
11
|
export { IsolatedDeclarationsResult, __ΩIsolatedDeclarationsResult, isolatedDeclarations } from './typescript/isolated-decl.cjs';
|
|
11
12
|
export { SourcesMap, __ΩSourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from './typescript/program.cjs';
|
|
12
13
|
export { createProgram } from './typescript/ts-morph.cjs';
|
|
13
14
|
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound, isMatchFound } from './typescript/tsconfig.cjs';
|
|
14
15
|
export { createUnpluginFactory } from './unplugin/factory.cjs';
|
|
16
|
+
export { combineContexts } from './unplugin/helpers.cjs';
|
|
15
17
|
export { CreateUnpluginOptions, __ΩCreateUnpluginOptions, createUnplugin } from './unplugin/plugin.cjs';
|
|
16
|
-
export { ResolveIdArgs, ResolveIdOptions, __ΩResolveIdArgs, __ΩResolveIdOptions, handleResolveId } from './unplugin/resolve-id.cjs';
|
|
17
18
|
export { bundle } from './utilities/bundle.cjs';
|
|
18
19
|
export { getCache, setCache } from './utilities/cache.cjs';
|
|
19
20
|
export { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from './utilities/file-header.cjs';
|
|
20
21
|
export { CACHE_HASH_LENGTH, CreateContextOptions, PROJECT_ROOT_HASH_LENGTH, __ΩCreateContextOptions, discoverTemplates, getPersistedMeta, getPrefixedProjectRootHash, writeMetaFile } from './utilities/meta.cjs';
|
|
21
22
|
export { resolve } from './utilities/resolve.cjs';
|
|
22
|
-
export { resolvePath } from './utilities/resolve-path.cjs';
|
|
23
23
|
export { getMagicString, getSourceFile, getString } from './utilities/source-file.cjs';
|
|
24
24
|
export { generateSourceMap } from './utilities/source-map.cjs';
|
|
25
25
|
export { Worker, WorkerOptions, __ΩWorkerOptions, createWorker } from './utilities/worker.cjs';
|
|
@@ -28,9 +28,10 @@ import 'jiti';
|
|
|
28
28
|
import '@stryke/env/get-env-paths';
|
|
29
29
|
import '@stryke/types/package-json';
|
|
30
30
|
import 'semver';
|
|
31
|
+
import 'ts-morph';
|
|
31
32
|
import 'unplugin';
|
|
32
|
-
import './internal-
|
|
33
|
-
import './api-
|
|
33
|
+
import './internal-CaGANOWK.cjs';
|
|
34
|
+
import './api-BRMITKt-.cjs';
|
|
34
35
|
import './tsconfig-Bz-CiFqD.cjs';
|
|
35
36
|
import '@stryke/types/tsconfig';
|
|
36
37
|
import 'typescript';
|
|
@@ -52,9 +53,9 @@ import 'rollup';
|
|
|
52
53
|
import 'webpack';
|
|
53
54
|
import 'jest-worker';
|
|
54
55
|
import 'magic-string';
|
|
56
|
+
import '@stryke/fs/resolve';
|
|
55
57
|
import '@stryke/types/array';
|
|
56
|
-
import '
|
|
57
|
-
import './unplugin-ppAOzR__.cjs';
|
|
58
|
+
import './unplugin-bUSyjd0S.cjs';
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* Represents a virtual file system (VFS) that stores files and their associated metadata in virtual memory.
|
|
@@ -81,15 +82,16 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
81
82
|
/**
|
|
82
83
|
* A map of file ids to their metadata.
|
|
83
84
|
*/
|
|
84
|
-
get metadata(): Record<string, VirtualFileMetadata
|
|
85
|
+
get metadata(): Readonly<Record<string, VirtualFileMetadata>>;
|
|
85
86
|
/**
|
|
86
|
-
* A map of
|
|
87
|
+
* A map of file paths to their module ids.
|
|
87
88
|
*/
|
|
88
|
-
get ids(): Record<string, string
|
|
89
|
+
get ids(): Readonly<Record<string, string>>;
|
|
89
90
|
/**
|
|
90
|
-
* A map of
|
|
91
|
+
* A map of module ids to their file paths.
|
|
91
92
|
*/
|
|
92
|
-
get paths(): Record<string, string
|
|
93
|
+
get paths(): Readonly<Record<string, string>>;
|
|
94
|
+
protected get resolverCache(): FlatCache;
|
|
93
95
|
/**
|
|
94
96
|
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
95
97
|
*
|
|
@@ -101,18 +103,16 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
101
103
|
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
102
104
|
*
|
|
103
105
|
* @param pathOrId - The path or id to check.
|
|
104
|
-
* @param options - Optional parameters for resolving the path.
|
|
105
106
|
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
106
107
|
*/
|
|
107
|
-
isVirtual(pathOrId: string, options?:
|
|
108
|
+
isVirtual(pathOrId: string, importer?: string, options?: ResolveOptions): boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
110
111
|
*
|
|
111
112
|
* @param pathOrId - The path or id to check.
|
|
112
|
-
* @param options - Optional parameters for resolving the path.
|
|
113
113
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
114
114
|
*/
|
|
115
|
-
isPhysical(pathOrId: string, options?:
|
|
115
|
+
isPhysical(pathOrId: string, importer?: string, options?: ResolveOptions): boolean;
|
|
116
116
|
/**
|
|
117
117
|
* Lists files in a given path.
|
|
118
118
|
*
|
|
@@ -130,20 +130,20 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
130
130
|
*
|
|
131
131
|
* @param path - The path to create the directory at.
|
|
132
132
|
*/
|
|
133
|
-
unlinkSync(path:
|
|
133
|
+
unlinkSync(path: string, options?: ResolveFSOptions): void;
|
|
134
134
|
/**
|
|
135
135
|
* Removes a file in the virtual file system (VFS).
|
|
136
136
|
*
|
|
137
137
|
* @param path - The path to create the directory at.
|
|
138
138
|
*/
|
|
139
|
-
unlink(path:
|
|
139
|
+
unlink(path: string, options?: ResolveFSOptions): Promise<void>;
|
|
140
140
|
/**
|
|
141
141
|
* Removes a directory in the virtual file system (VFS).
|
|
142
142
|
*
|
|
143
143
|
* @param path - The path to create the directory at.
|
|
144
144
|
* @param options - Options for creating the directory.
|
|
145
145
|
*/
|
|
146
|
-
rmdirSync(path:
|
|
146
|
+
rmdirSync(path: string, options?: fs.RmDirOptions & ResolveFSOptions): void;
|
|
147
147
|
/**
|
|
148
148
|
* Removes a directory in the virtual file system (VFS).
|
|
149
149
|
*
|
|
@@ -151,7 +151,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
151
151
|
* @param options - Options for creating the directory.
|
|
152
152
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
153
153
|
*/
|
|
154
|
-
rmdir(path:
|
|
154
|
+
rmdir(path: string, options?: fs.RmDirOptions & ResolveFSOptions): Promise<void>;
|
|
155
155
|
/**
|
|
156
156
|
* Removes a file in the virtual file system (VFS).
|
|
157
157
|
*
|
|
@@ -159,14 +159,14 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
159
159
|
* @param options - Options for removing the file.
|
|
160
160
|
* @returns A promise that resolves when the file is removed.
|
|
161
161
|
*/
|
|
162
|
-
rm(path:
|
|
162
|
+
rm(path: string, options?: fs.RmOptions & ResolveFSOptions): Promise<void>;
|
|
163
163
|
/**
|
|
164
164
|
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
165
165
|
*
|
|
166
166
|
* @param path - The path to the file or directory to remove.
|
|
167
167
|
* @param options - Options for removing the file or directory.
|
|
168
168
|
*/
|
|
169
|
-
rmSync(path:
|
|
169
|
+
rmSync(path: string, options?: fs.RmOptions & ResolveFSOptions): void;
|
|
170
170
|
/**
|
|
171
171
|
* Creates a directory in the virtual file system (VFS).
|
|
172
172
|
*
|
|
@@ -174,7 +174,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
174
174
|
* @param options - Options for creating the directory.
|
|
175
175
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
176
176
|
*/
|
|
177
|
-
mkdirSync(path:
|
|
177
|
+
mkdirSync(path: string, options?: MakeDirectoryOptions): string | undefined;
|
|
178
178
|
/**
|
|
179
179
|
* Creates a directory in the virtual file system (VFS).
|
|
180
180
|
*
|
|
@@ -182,7 +182,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
182
182
|
* @param options - Options for creating the directory.
|
|
183
183
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
184
184
|
*/
|
|
185
|
-
mkdir(path:
|
|
185
|
+
mkdir(path: string, options?: MakeDirectoryOptions): Promise<string | undefined>;
|
|
186
186
|
/**
|
|
187
187
|
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
188
188
|
*
|
|
@@ -232,7 +232,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
232
232
|
* @param options - Options for listing files, such as encoding and recursion.
|
|
233
233
|
* @returns An array of file names in the specified path.
|
|
234
234
|
*/
|
|
235
|
-
readdir(pathOrId:
|
|
235
|
+
readdir(pathOrId: string, options?: {
|
|
236
236
|
encoding: BufferEncoding | null;
|
|
237
237
|
withFileTypes?: false | undefined;
|
|
238
238
|
recursive?: boolean | undefined;
|
|
@@ -243,7 +243,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
243
243
|
* @param pathOrId - The path or ID of the file to read.
|
|
244
244
|
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
245
245
|
*/
|
|
246
|
-
readFile(pathOrId:
|
|
246
|
+
readFile(pathOrId: string, options?: (ObjectEncodingOptions & {
|
|
247
247
|
flag?: string | undefined;
|
|
248
248
|
}) | BufferEncoding): Promise<string | undefined>;
|
|
249
249
|
/**
|
|
@@ -252,7 +252,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
252
252
|
* @param pathOrId - The path or ID of the file to read.
|
|
253
253
|
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
254
254
|
*/
|
|
255
|
-
readFileSync(pathOrId:
|
|
255
|
+
readFileSync(pathOrId: string, options?: (fs.ObjectEncodingOptions & {
|
|
256
256
|
flag?: string | undefined;
|
|
257
257
|
}) | BufferEncoding | null): string | undefined;
|
|
258
258
|
/**
|
|
@@ -263,7 +263,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
263
263
|
* @param options - Optional parameters for writing the file.
|
|
264
264
|
* @returns A promise that resolves when the file is written.
|
|
265
265
|
*/
|
|
266
|
-
writeFile(path:
|
|
266
|
+
writeFile(path: string, data?: WriteFileData, options?: WriteFileOptions): Promise<void>;
|
|
267
267
|
/**
|
|
268
268
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
269
269
|
*
|
|
@@ -271,21 +271,21 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
271
271
|
* @param data - The contents of the file.
|
|
272
272
|
* @param options - Optional parameters for writing the file.
|
|
273
273
|
*/
|
|
274
|
-
writeFileSync(path:
|
|
274
|
+
writeFileSync(path: string, data?: WriteFileData, options?: WriteFileOptions): void;
|
|
275
275
|
/**
|
|
276
276
|
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
277
277
|
*
|
|
278
278
|
* @param pathOrId - The path or ID of the file to check.
|
|
279
279
|
* @returns `true` if the file exists, otherwise `false`.
|
|
280
280
|
*/
|
|
281
|
-
existsSync(pathOrId:
|
|
281
|
+
existsSync(pathOrId: string): boolean;
|
|
282
282
|
/**
|
|
283
283
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
284
284
|
*
|
|
285
285
|
* @param pathOrId - The path or ID of the file to retrieve metadata for.
|
|
286
286
|
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
287
287
|
*/
|
|
288
|
-
getMetadata(pathOrId:
|
|
288
|
+
getMetadata(pathOrId: string): VirtualFileMetadata | undefined;
|
|
289
289
|
/**
|
|
290
290
|
* Checks if a file exists in the virtual file system (VFS).
|
|
291
291
|
*
|
|
@@ -295,21 +295,21 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
295
295
|
* @param pathOrId - The path of the file to check.
|
|
296
296
|
* @returns `true` if the file exists, otherwise `false`.
|
|
297
297
|
*/
|
|
298
|
-
isFile(pathOrId:
|
|
298
|
+
isFile(pathOrId: string): boolean;
|
|
299
299
|
/**
|
|
300
300
|
* Checks if a directory exists in the virtual file system (VFS).
|
|
301
301
|
*
|
|
302
302
|
* @param pathOrId - The path of the directory to check.
|
|
303
303
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
304
304
|
*/
|
|
305
|
-
isDirectory(pathOrId:
|
|
305
|
+
isDirectory(pathOrId: string): boolean;
|
|
306
306
|
/**
|
|
307
307
|
* Retrieves the status of a file in the virtual file system (VFS).
|
|
308
308
|
*
|
|
309
309
|
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
310
310
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
311
311
|
*/
|
|
312
|
-
stat(pathOrId:
|
|
312
|
+
stat(pathOrId: string, options?: fs.StatOptions & {
|
|
313
313
|
bigint?: false | undefined;
|
|
314
314
|
}): Promise<Stats>;
|
|
315
315
|
/**
|
|
@@ -318,14 +318,14 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
318
318
|
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
319
319
|
* @returns The file's status information, or false if the file does not exist.
|
|
320
320
|
*/
|
|
321
|
-
statSync(pathOrId:
|
|
321
|
+
statSync(pathOrId: string): Stats;
|
|
322
322
|
/**
|
|
323
323
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
324
324
|
*
|
|
325
325
|
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
326
326
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
327
327
|
*/
|
|
328
|
-
lstat(pathOrId:
|
|
328
|
+
lstat(pathOrId: string, options?: fs.StatOptions & {
|
|
329
329
|
bigint?: false | undefined;
|
|
330
330
|
}): Promise<Stats>;
|
|
331
331
|
/**
|
|
@@ -334,7 +334,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
334
334
|
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
335
335
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
336
336
|
*/
|
|
337
|
-
lstatSync(pathOrId:
|
|
337
|
+
lstatSync(pathOrId: string, options?: StatSyncOptions & {
|
|
338
338
|
bigint?: false | undefined;
|
|
339
339
|
throwIfNoEntry: false;
|
|
340
340
|
}): Stats | undefined;
|
|
@@ -344,22 +344,41 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
344
344
|
* @param pathOrId - The path or ID to resolve.
|
|
345
345
|
* @returns The resolved real path if it exists, otherwise undefined.
|
|
346
346
|
*/
|
|
347
|
-
realpathSync(pathOrId:
|
|
347
|
+
realpathSync(pathOrId: string): string;
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
350
350
|
*
|
|
351
|
-
* @
|
|
352
|
-
*
|
|
353
|
-
*
|
|
351
|
+
* @remarks
|
|
352
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
* @param id - The module to resolve.
|
|
360
|
+
* @param importer - An optional path to the importer module.
|
|
361
|
+
* @param options - Additional resolution options.
|
|
362
|
+
* @returns A promise that resolves to the resolved module path.
|
|
354
363
|
*/
|
|
355
|
-
resolve(
|
|
364
|
+
resolve(id: string, importer?: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
356
365
|
/**
|
|
357
|
-
*
|
|
366
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
367
|
+
*
|
|
368
|
+
* @remarks
|
|
369
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
374
|
+
* ```
|
|
358
375
|
*
|
|
359
|
-
* @param
|
|
360
|
-
* @
|
|
376
|
+
* @param id - The module to resolve.
|
|
377
|
+
* @param importer - An optional path to the importer module.
|
|
378
|
+
* @param options - Additional resolution options.
|
|
379
|
+
* @returns The resolved module path.
|
|
361
380
|
*/
|
|
362
|
-
|
|
381
|
+
resolveSync(id: string, importer?: string, options?: ResolveOptions): string | undefined;
|
|
363
382
|
/**
|
|
364
383
|
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
365
384
|
*/
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -4,22 +4,22 @@ export { PowerlinesContext } from './contexts/context.js';
|
|
|
4
4
|
export { PowerlinesEnvironmentContext } from './contexts/environment-context.js';
|
|
5
5
|
export { createPluginContext } from './contexts/plugin-context.js';
|
|
6
6
|
export { getUniqueEntries, resolveEntries, resolveEntriesSync, resolveEntry, resolveEntryInput, resolveEntryInputFile, resolveEntryOutput, resolveVirtualEntry } from './entry.js';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { FlatCache } from 'flat-cache';
|
|
8
|
+
import fs, { ObjectEncodingOptions, Stats, StatSyncOptions } from 'node:fs';
|
|
9
|
+
import { V as VirtualFileSystemInterface, C as Context, a as VirtualFileMetadata, R as ResolveOptions, b as ResolveFSOptions, M as MakeDirectoryOptions, W as WriteFileData, c as WriteFileOptions, _ as __VFS_PATCH__, d as __VFS_REVERT__ } from './config-DBIFdRoq.js';
|
|
9
10
|
export { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from './logger.js';
|
|
10
11
|
export { IsolatedDeclarationsResult, __ΩIsolatedDeclarationsResult, isolatedDeclarations } from './typescript/isolated-decl.js';
|
|
11
12
|
export { SourcesMap, __ΩSourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from './typescript/program.js';
|
|
12
13
|
export { createProgram } from './typescript/ts-morph.js';
|
|
13
14
|
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound, isMatchFound } from './typescript/tsconfig.js';
|
|
14
15
|
export { createUnpluginFactory } from './unplugin/factory.js';
|
|
16
|
+
export { combineContexts } from './unplugin/helpers.js';
|
|
15
17
|
export { CreateUnpluginOptions, __ΩCreateUnpluginOptions, createUnplugin } from './unplugin/plugin.js';
|
|
16
|
-
export { ResolveIdArgs, ResolveIdOptions, __ΩResolveIdArgs, __ΩResolveIdOptions, handleResolveId } from './unplugin/resolve-id.js';
|
|
17
18
|
export { bundle } from './utilities/bundle.js';
|
|
18
19
|
export { getCache, setCache } from './utilities/cache.js';
|
|
19
20
|
export { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from './utilities/file-header.js';
|
|
20
21
|
export { CACHE_HASH_LENGTH, CreateContextOptions, PROJECT_ROOT_HASH_LENGTH, __ΩCreateContextOptions, discoverTemplates, getPersistedMeta, getPrefixedProjectRootHash, writeMetaFile } from './utilities/meta.js';
|
|
21
22
|
export { resolve } from './utilities/resolve.js';
|
|
22
|
-
export { resolvePath } from './utilities/resolve-path.js';
|
|
23
23
|
export { getMagicString, getSourceFile, getString } from './utilities/source-file.js';
|
|
24
24
|
export { generateSourceMap } from './utilities/source-map.js';
|
|
25
25
|
export { Worker, WorkerOptions, __ΩWorkerOptions, createWorker } from './utilities/worker.js';
|
|
@@ -28,9 +28,10 @@ import 'jiti';
|
|
|
28
28
|
import '@stryke/env/get-env-paths';
|
|
29
29
|
import '@stryke/types/package-json';
|
|
30
30
|
import 'semver';
|
|
31
|
+
import 'ts-morph';
|
|
31
32
|
import 'unplugin';
|
|
32
|
-
import './internal-
|
|
33
|
-
import './api-
|
|
33
|
+
import './internal-1qCyw7bA.js';
|
|
34
|
+
import './api-CDUN9en8.js';
|
|
34
35
|
import './tsconfig-Bz-CiFqD.js';
|
|
35
36
|
import '@stryke/types/tsconfig';
|
|
36
37
|
import 'typescript';
|
|
@@ -52,9 +53,9 @@ import 'rollup';
|
|
|
52
53
|
import 'webpack';
|
|
53
54
|
import 'jest-worker';
|
|
54
55
|
import 'magic-string';
|
|
56
|
+
import '@stryke/fs/resolve';
|
|
55
57
|
import '@stryke/types/array';
|
|
56
|
-
import '
|
|
57
|
-
import './unplugin-CbbNDduM.js';
|
|
58
|
+
import './unplugin-CEeJqADD.js';
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* Represents a virtual file system (VFS) that stores files and their associated metadata in virtual memory.
|
|
@@ -81,15 +82,16 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
81
82
|
/**
|
|
82
83
|
* A map of file ids to their metadata.
|
|
83
84
|
*/
|
|
84
|
-
get metadata(): Record<string, VirtualFileMetadata
|
|
85
|
+
get metadata(): Readonly<Record<string, VirtualFileMetadata>>;
|
|
85
86
|
/**
|
|
86
|
-
* A map of
|
|
87
|
+
* A map of file paths to their module ids.
|
|
87
88
|
*/
|
|
88
|
-
get ids(): Record<string, string
|
|
89
|
+
get ids(): Readonly<Record<string, string>>;
|
|
89
90
|
/**
|
|
90
|
-
* A map of
|
|
91
|
+
* A map of module ids to their file paths.
|
|
91
92
|
*/
|
|
92
|
-
get paths(): Record<string, string
|
|
93
|
+
get paths(): Readonly<Record<string, string>>;
|
|
94
|
+
protected get resolverCache(): FlatCache;
|
|
93
95
|
/**
|
|
94
96
|
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
95
97
|
*
|
|
@@ -101,18 +103,16 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
101
103
|
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
102
104
|
*
|
|
103
105
|
* @param pathOrId - The path or id to check.
|
|
104
|
-
* @param options - Optional parameters for resolving the path.
|
|
105
106
|
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
106
107
|
*/
|
|
107
|
-
isVirtual(pathOrId: string, options?:
|
|
108
|
+
isVirtual(pathOrId: string, importer?: string, options?: ResolveOptions): boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
110
111
|
*
|
|
111
112
|
* @param pathOrId - The path or id to check.
|
|
112
|
-
* @param options - Optional parameters for resolving the path.
|
|
113
113
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
114
114
|
*/
|
|
115
|
-
isPhysical(pathOrId: string, options?:
|
|
115
|
+
isPhysical(pathOrId: string, importer?: string, options?: ResolveOptions): boolean;
|
|
116
116
|
/**
|
|
117
117
|
* Lists files in a given path.
|
|
118
118
|
*
|
|
@@ -130,20 +130,20 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
130
130
|
*
|
|
131
131
|
* @param path - The path to create the directory at.
|
|
132
132
|
*/
|
|
133
|
-
unlinkSync(path:
|
|
133
|
+
unlinkSync(path: string, options?: ResolveFSOptions): void;
|
|
134
134
|
/**
|
|
135
135
|
* Removes a file in the virtual file system (VFS).
|
|
136
136
|
*
|
|
137
137
|
* @param path - The path to create the directory at.
|
|
138
138
|
*/
|
|
139
|
-
unlink(path:
|
|
139
|
+
unlink(path: string, options?: ResolveFSOptions): Promise<void>;
|
|
140
140
|
/**
|
|
141
141
|
* Removes a directory in the virtual file system (VFS).
|
|
142
142
|
*
|
|
143
143
|
* @param path - The path to create the directory at.
|
|
144
144
|
* @param options - Options for creating the directory.
|
|
145
145
|
*/
|
|
146
|
-
rmdirSync(path:
|
|
146
|
+
rmdirSync(path: string, options?: fs.RmDirOptions & ResolveFSOptions): void;
|
|
147
147
|
/**
|
|
148
148
|
* Removes a directory in the virtual file system (VFS).
|
|
149
149
|
*
|
|
@@ -151,7 +151,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
151
151
|
* @param options - Options for creating the directory.
|
|
152
152
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
153
153
|
*/
|
|
154
|
-
rmdir(path:
|
|
154
|
+
rmdir(path: string, options?: fs.RmDirOptions & ResolveFSOptions): Promise<void>;
|
|
155
155
|
/**
|
|
156
156
|
* Removes a file in the virtual file system (VFS).
|
|
157
157
|
*
|
|
@@ -159,14 +159,14 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
159
159
|
* @param options - Options for removing the file.
|
|
160
160
|
* @returns A promise that resolves when the file is removed.
|
|
161
161
|
*/
|
|
162
|
-
rm(path:
|
|
162
|
+
rm(path: string, options?: fs.RmOptions & ResolveFSOptions): Promise<void>;
|
|
163
163
|
/**
|
|
164
164
|
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
165
165
|
*
|
|
166
166
|
* @param path - The path to the file or directory to remove.
|
|
167
167
|
* @param options - Options for removing the file or directory.
|
|
168
168
|
*/
|
|
169
|
-
rmSync(path:
|
|
169
|
+
rmSync(path: string, options?: fs.RmOptions & ResolveFSOptions): void;
|
|
170
170
|
/**
|
|
171
171
|
* Creates a directory in the virtual file system (VFS).
|
|
172
172
|
*
|
|
@@ -174,7 +174,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
174
174
|
* @param options - Options for creating the directory.
|
|
175
175
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
176
176
|
*/
|
|
177
|
-
mkdirSync(path:
|
|
177
|
+
mkdirSync(path: string, options?: MakeDirectoryOptions): string | undefined;
|
|
178
178
|
/**
|
|
179
179
|
* Creates a directory in the virtual file system (VFS).
|
|
180
180
|
*
|
|
@@ -182,7 +182,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
182
182
|
* @param options - Options for creating the directory.
|
|
183
183
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
184
184
|
*/
|
|
185
|
-
mkdir(path:
|
|
185
|
+
mkdir(path: string, options?: MakeDirectoryOptions): Promise<string | undefined>;
|
|
186
186
|
/**
|
|
187
187
|
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
188
188
|
*
|
|
@@ -232,7 +232,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
232
232
|
* @param options - Options for listing files, such as encoding and recursion.
|
|
233
233
|
* @returns An array of file names in the specified path.
|
|
234
234
|
*/
|
|
235
|
-
readdir(pathOrId:
|
|
235
|
+
readdir(pathOrId: string, options?: {
|
|
236
236
|
encoding: BufferEncoding | null;
|
|
237
237
|
withFileTypes?: false | undefined;
|
|
238
238
|
recursive?: boolean | undefined;
|
|
@@ -243,7 +243,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
243
243
|
* @param pathOrId - The path or ID of the file to read.
|
|
244
244
|
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
245
245
|
*/
|
|
246
|
-
readFile(pathOrId:
|
|
246
|
+
readFile(pathOrId: string, options?: (ObjectEncodingOptions & {
|
|
247
247
|
flag?: string | undefined;
|
|
248
248
|
}) | BufferEncoding): Promise<string | undefined>;
|
|
249
249
|
/**
|
|
@@ -252,7 +252,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
252
252
|
* @param pathOrId - The path or ID of the file to read.
|
|
253
253
|
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
254
254
|
*/
|
|
255
|
-
readFileSync(pathOrId:
|
|
255
|
+
readFileSync(pathOrId: string, options?: (fs.ObjectEncodingOptions & {
|
|
256
256
|
flag?: string | undefined;
|
|
257
257
|
}) | BufferEncoding | null): string | undefined;
|
|
258
258
|
/**
|
|
@@ -263,7 +263,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
263
263
|
* @param options - Optional parameters for writing the file.
|
|
264
264
|
* @returns A promise that resolves when the file is written.
|
|
265
265
|
*/
|
|
266
|
-
writeFile(path:
|
|
266
|
+
writeFile(path: string, data?: WriteFileData, options?: WriteFileOptions): Promise<void>;
|
|
267
267
|
/**
|
|
268
268
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
269
269
|
*
|
|
@@ -271,21 +271,21 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
271
271
|
* @param data - The contents of the file.
|
|
272
272
|
* @param options - Optional parameters for writing the file.
|
|
273
273
|
*/
|
|
274
|
-
writeFileSync(path:
|
|
274
|
+
writeFileSync(path: string, data?: WriteFileData, options?: WriteFileOptions): void;
|
|
275
275
|
/**
|
|
276
276
|
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
277
277
|
*
|
|
278
278
|
* @param pathOrId - The path or ID of the file to check.
|
|
279
279
|
* @returns `true` if the file exists, otherwise `false`.
|
|
280
280
|
*/
|
|
281
|
-
existsSync(pathOrId:
|
|
281
|
+
existsSync(pathOrId: string): boolean;
|
|
282
282
|
/**
|
|
283
283
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
284
284
|
*
|
|
285
285
|
* @param pathOrId - The path or ID of the file to retrieve metadata for.
|
|
286
286
|
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
287
287
|
*/
|
|
288
|
-
getMetadata(pathOrId:
|
|
288
|
+
getMetadata(pathOrId: string): VirtualFileMetadata | undefined;
|
|
289
289
|
/**
|
|
290
290
|
* Checks if a file exists in the virtual file system (VFS).
|
|
291
291
|
*
|
|
@@ -295,21 +295,21 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
295
295
|
* @param pathOrId - The path of the file to check.
|
|
296
296
|
* @returns `true` if the file exists, otherwise `false`.
|
|
297
297
|
*/
|
|
298
|
-
isFile(pathOrId:
|
|
298
|
+
isFile(pathOrId: string): boolean;
|
|
299
299
|
/**
|
|
300
300
|
* Checks if a directory exists in the virtual file system (VFS).
|
|
301
301
|
*
|
|
302
302
|
* @param pathOrId - The path of the directory to check.
|
|
303
303
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
304
304
|
*/
|
|
305
|
-
isDirectory(pathOrId:
|
|
305
|
+
isDirectory(pathOrId: string): boolean;
|
|
306
306
|
/**
|
|
307
307
|
* Retrieves the status of a file in the virtual file system (VFS).
|
|
308
308
|
*
|
|
309
309
|
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
310
310
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
311
311
|
*/
|
|
312
|
-
stat(pathOrId:
|
|
312
|
+
stat(pathOrId: string, options?: fs.StatOptions & {
|
|
313
313
|
bigint?: false | undefined;
|
|
314
314
|
}): Promise<Stats>;
|
|
315
315
|
/**
|
|
@@ -318,14 +318,14 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
318
318
|
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
319
319
|
* @returns The file's status information, or false if the file does not exist.
|
|
320
320
|
*/
|
|
321
|
-
statSync(pathOrId:
|
|
321
|
+
statSync(pathOrId: string): Stats;
|
|
322
322
|
/**
|
|
323
323
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
324
324
|
*
|
|
325
325
|
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
326
326
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
327
327
|
*/
|
|
328
|
-
lstat(pathOrId:
|
|
328
|
+
lstat(pathOrId: string, options?: fs.StatOptions & {
|
|
329
329
|
bigint?: false | undefined;
|
|
330
330
|
}): Promise<Stats>;
|
|
331
331
|
/**
|
|
@@ -334,7 +334,7 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
334
334
|
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
335
335
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
336
336
|
*/
|
|
337
|
-
lstatSync(pathOrId:
|
|
337
|
+
lstatSync(pathOrId: string, options?: StatSyncOptions & {
|
|
338
338
|
bigint?: false | undefined;
|
|
339
339
|
throwIfNoEntry: false;
|
|
340
340
|
}): Stats | undefined;
|
|
@@ -344,22 +344,41 @@ declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
|
344
344
|
* @param pathOrId - The path or ID to resolve.
|
|
345
345
|
* @returns The resolved real path if it exists, otherwise undefined.
|
|
346
346
|
*/
|
|
347
|
-
realpathSync(pathOrId:
|
|
347
|
+
realpathSync(pathOrId: string): string;
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
350
350
|
*
|
|
351
|
-
* @
|
|
352
|
-
*
|
|
353
|
-
*
|
|
351
|
+
* @remarks
|
|
352
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
* @param id - The module to resolve.
|
|
360
|
+
* @param importer - An optional path to the importer module.
|
|
361
|
+
* @param options - Additional resolution options.
|
|
362
|
+
* @returns A promise that resolves to the resolved module path.
|
|
354
363
|
*/
|
|
355
|
-
resolve(
|
|
364
|
+
resolve(id: string, importer?: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
356
365
|
/**
|
|
357
|
-
*
|
|
366
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
367
|
+
*
|
|
368
|
+
* @remarks
|
|
369
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
374
|
+
* ```
|
|
358
375
|
*
|
|
359
|
-
* @param
|
|
360
|
-
* @
|
|
376
|
+
* @param id - The module to resolve.
|
|
377
|
+
* @param importer - An optional path to the importer module.
|
|
378
|
+
* @param options - Additional resolution options.
|
|
379
|
+
* @returns The resolved module path.
|
|
361
380
|
*/
|
|
362
|
-
|
|
381
|
+
resolveSync(id: string, importer?: string, options?: ResolveOptions): string | undefined;
|
|
363
382
|
/**
|
|
364
383
|
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
365
384
|
*/
|