@powerlines/core 0.14.5 → 0.15.1
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/constants/api.cjs +6 -5
- package/dist/constants/api.d.cts +3 -3
- package/dist/constants/api.d.cts.map +1 -1
- package/dist/constants/api.d.mts +3 -3
- package/dist/constants/api.d.mts.map +1 -1
- package/dist/constants/api.mjs +4 -4
- package/dist/constants/api.mjs.map +1 -1
- package/dist/constants/commands.cjs +3 -2
- package/dist/constants/commands.d.cts +1 -1
- package/dist/constants/commands.d.mts +1 -1
- package/dist/constants/commands.mjs +2 -2
- package/dist/constants/commands.mjs.map +1 -1
- package/dist/constants/devtools.cjs +23 -0
- package/dist/constants/devtools.d.cts +13 -0
- package/dist/constants/devtools.d.cts.map +1 -0
- package/dist/constants/devtools.d.mts +13 -0
- package/dist/constants/devtools.d.mts.map +1 -0
- package/dist/constants/devtools.mjs +14 -0
- package/dist/constants/devtools.mjs.map +1 -0
- package/dist/constants/environments.cjs +1 -0
- package/dist/constants/extensions.cjs +21 -0
- package/dist/constants/extensions.d.cts +5 -0
- package/dist/constants/extensions.d.cts.map +1 -0
- package/dist/constants/extensions.d.mts +5 -0
- package/dist/constants/extensions.d.mts.map +1 -0
- package/dist/constants/extensions.mjs +20 -0
- package/dist/constants/extensions.mjs.map +1 -0
- package/dist/constants/fs.cjs +1 -0
- package/dist/constants/hooks.cjs +1 -0
- package/dist/constants/index.cjs +48 -30
- package/dist/constants/index.d.cts +5 -3
- package/dist/constants/index.d.mts +5 -3
- package/dist/constants/index.mjs +5 -3
- package/dist/constants/log-level.cjs +90 -0
- package/dist/constants/log-level.d.cts +63 -0
- package/dist/constants/log-level.d.cts.map +1 -0
- package/dist/constants/log-level.d.mts +63 -0
- package/dist/constants/log-level.d.mts.map +1 -0
- package/dist/constants/log-level.mjs +82 -0
- package/dist/constants/log-level.mjs.map +1 -0
- package/dist/constants/meta.cjs +1 -0
- package/dist/constants/plugin.cjs +3 -2
- package/dist/constants/plugin.d.cts +2 -2
- package/dist/constants/plugin.d.mts +2 -2
- package/dist/context/base-context.cjs +127 -0
- package/dist/context/base-context.d.cts +81 -0
- package/dist/context/base-context.d.cts.map +1 -0
- package/dist/context/base-context.d.mts +81 -0
- package/dist/context/base-context.d.mts.map +1 -0
- package/dist/context/base-context.mjs +125 -0
- package/dist/context/base-context.mjs.map +1 -0
- package/dist/context/context.cjs +934 -0
- package/dist/context/context.d.cts +369 -0
- package/dist/context/context.d.cts.map +1 -0
- package/dist/context/context.d.mts +369 -0
- package/dist/context/context.d.mts.map +1 -0
- package/dist/context/context.mjs +932 -0
- package/dist/context/context.mjs.map +1 -0
- package/dist/context/environment-context.cjs +219 -0
- package/dist/context/environment-context.d.cts +100 -0
- package/dist/context/environment-context.d.cts.map +1 -0
- package/dist/context/environment-context.d.mts +100 -0
- package/dist/context/environment-context.d.mts.map +1 -0
- package/dist/context/environment-context.mjs +218 -0
- package/dist/context/environment-context.mjs.map +1 -0
- package/dist/context/execution-context.cjs +230 -0
- package/dist/context/execution-context.d.cts +101 -0
- package/dist/context/execution-context.d.cts.map +1 -0
- package/dist/context/execution-context.d.mts +101 -0
- package/dist/context/execution-context.d.mts.map +1 -0
- package/dist/context/execution-context.mjs +228 -0
- package/dist/context/execution-context.mjs.map +1 -0
- package/dist/context/index.cjs +12 -0
- package/dist/context/index.d.cts +6 -0
- package/dist/context/index.d.mts +6 -0
- package/dist/context/index.mjs +7 -0
- package/dist/context/plugin-context.cjs +83 -0
- package/dist/context/plugin-context.d.cts +18 -0
- package/dist/context/plugin-context.d.cts.map +1 -0
- package/dist/context/plugin-context.d.mts +18 -0
- package/dist/context/plugin-context.d.mts.map +1 -0
- package/dist/context/plugin-context.mjs +82 -0
- package/dist/context/plugin-context.mjs.map +1 -0
- package/dist/index.cjs +62 -9
- package/dist/index.d.cts +20 -9
- package/dist/index.d.mts +20 -9
- package/dist/index.mjs +17 -5
- package/dist/lib/config.cjs +160 -15
- package/dist/lib/config.d.cts +92 -6
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +92 -6
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +154 -16
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.cjs +43 -0
- package/dist/lib/context-helpers.d.cts +19 -0
- package/dist/lib/context-helpers.d.cts.map +1 -0
- package/dist/lib/context-helpers.d.mts +19 -0
- package/dist/lib/context-helpers.d.mts.map +1 -0
- package/dist/lib/context-helpers.mjs +41 -0
- package/dist/lib/context-helpers.mjs.map +1 -0
- package/dist/lib/entry.cjs +5 -5
- package/dist/lib/entry.d.cts.map +1 -1
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs +5 -5
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/environment.cjs +72 -0
- package/dist/lib/environment.d.cts +12 -0
- package/dist/lib/environment.d.cts.map +1 -0
- package/dist/lib/environment.d.mts +12 -0
- package/dist/lib/environment.d.mts.map +1 -0
- package/dist/lib/environment.mjs +67 -0
- package/dist/lib/environment.mjs.map +1 -0
- package/dist/lib/events.cjs +43 -0
- package/dist/lib/events.d.cts +10 -0
- package/dist/lib/events.d.cts.map +1 -0
- package/dist/lib/events.d.mts +10 -0
- package/dist/lib/events.d.mts.map +1 -0
- package/dist/lib/events.mjs +42 -0
- package/dist/lib/events.mjs.map +1 -0
- package/dist/lib/generate-types.cjs +371 -0
- package/dist/lib/generate-types.d.cts +67 -0
- package/dist/lib/generate-types.d.cts.map +1 -0
- package/dist/lib/generate-types.d.mts +67 -0
- package/dist/lib/generate-types.d.mts.map +1 -0
- package/dist/lib/generate-types.mjs +368 -0
- package/dist/lib/generate-types.mjs.map +1 -0
- package/dist/lib/hooks.cjs +152 -0
- package/dist/lib/hooks.d.cts +28 -0
- package/dist/lib/hooks.d.cts.map +1 -0
- package/dist/lib/hooks.d.mts +28 -0
- package/dist/lib/hooks.d.mts.map +1 -0
- package/dist/lib/hooks.mjs +147 -0
- package/dist/lib/hooks.mjs.map +1 -0
- package/dist/lib/index.cjs +64 -9
- package/dist/lib/index.d.cts +15 -3
- package/dist/lib/index.d.mts +15 -3
- package/dist/lib/index.mjs +19 -5
- package/dist/lib/install-dependencies.cjs +25 -0
- package/dist/lib/install-dependencies.d.cts +12 -0
- package/dist/lib/install-dependencies.d.cts.map +1 -0
- package/dist/lib/install-dependencies.d.mts +12 -0
- package/dist/lib/install-dependencies.d.mts.map +1 -0
- package/dist/lib/install-dependencies.mjs +24 -0
- package/dist/lib/install-dependencies.mjs.map +1 -0
- package/dist/lib/meta.cjs +57 -0
- package/dist/lib/meta.d.cts +34 -0
- package/dist/lib/meta.d.cts.map +1 -0
- package/dist/lib/meta.d.mts +34 -0
- package/dist/lib/meta.d.mts.map +1 -0
- package/dist/lib/meta.mjs +54 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/plugins.cjs +150 -0
- package/dist/lib/plugins.d.cts +40 -0
- package/dist/lib/plugins.d.cts.map +1 -0
- package/dist/lib/plugins.d.mts +40 -0
- package/dist/lib/plugins.d.mts.map +1 -0
- package/dist/lib/plugins.mjs +146 -0
- package/dist/lib/plugins.mjs.map +1 -0
- package/dist/lib/resolver.cjs +35 -0
- package/dist/lib/resolver.d.cts +21 -0
- package/dist/lib/resolver.d.cts.map +1 -0
- package/dist/lib/resolver.d.mts +21 -0
- package/dist/lib/resolver.d.mts.map +1 -0
- package/dist/lib/resolver.mjs +33 -0
- package/dist/lib/resolver.mjs.map +1 -0
- package/dist/lib/schemas.cjs +9 -0
- package/dist/lib/schemas.d.cts +2 -0
- package/dist/lib/schemas.d.mts +2 -0
- package/dist/lib/schemas.mjs +3 -0
- package/dist/lib/streaming-channel.cjs +260 -0
- package/dist/lib/streaming-channel.d.cts +133 -0
- package/dist/lib/streaming-channel.d.cts.map +1 -0
- package/dist/lib/streaming-channel.d.mts +133 -0
- package/dist/lib/streaming-channel.d.mts.map +1 -0
- package/dist/lib/streaming-channel.mjs +258 -0
- package/dist/lib/streaming-channel.mjs.map +1 -0
- package/dist/lib/typescript/index.cjs +16 -0
- package/dist/lib/typescript/index.d.cts +3 -0
- package/dist/lib/typescript/index.d.mts +3 -0
- package/dist/lib/typescript/index.mjs +4 -0
- package/dist/lib/typescript/ts-morph.cjs +105 -0
- package/dist/lib/typescript/ts-morph.d.cts +38 -0
- package/dist/lib/typescript/ts-morph.d.cts.map +1 -0
- package/dist/lib/typescript/ts-morph.d.mts +38 -0
- package/dist/lib/typescript/ts-morph.d.mts.map +1 -0
- package/dist/lib/typescript/ts-morph.mjs +102 -0
- package/dist/lib/typescript/ts-morph.mjs.map +1 -0
- package/dist/lib/typescript/tsconfig.cjs +253 -0
- package/dist/lib/typescript/tsconfig.d.cts +77 -0
- package/dist/lib/typescript/tsconfig.d.cts.map +1 -0
- package/dist/lib/typescript/tsconfig.d.mts +77 -0
- package/dist/lib/typescript/tsconfig.d.mts.map +1 -0
- package/dist/lib/typescript/tsconfig.mjs +240 -0
- package/dist/lib/typescript/tsconfig.mjs.map +1 -0
- package/dist/lib/unplugin/helpers.cjs +2 -2
- package/dist/lib/unplugin/module-resolution.cjs +18 -18
- package/dist/lib/unplugin/module-resolution.mjs +18 -18
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +55 -62
- package/dist/lib/unplugin/plugin.d.cts +10 -11
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts +10 -11
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +55 -62
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +2 -2
- package/dist/lib/utilities/file-header.mjs +2 -2
- package/dist/lib/utilities/file-header.mjs.map +1 -1
- package/dist/lib/utilities/format.cjs +1 -1
- package/dist/lib/utilities/format.mjs +1 -1
- package/dist/lib/utilities/index.cjs +2 -2
- package/dist/lib/utilities/index.mjs +2 -2
- package/dist/lib/utilities/write-file.cjs +1 -2
- package/dist/lib/utilities/write-file.d.cts +1 -1
- package/dist/lib/utilities/write-file.d.cts.map +1 -1
- package/dist/lib/utilities/write-file.d.mts +1 -1
- package/dist/lib/utilities/write-file.d.mts.map +1 -1
- package/dist/lib/utilities/write-file.mjs +1 -2
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/lib/vfs.cjs +1104 -0
- package/dist/lib/vfs.d.cts +321 -0
- package/dist/lib/vfs.d.cts.map +1 -0
- package/dist/lib/vfs.d.mts +321 -0
- package/dist/lib/vfs.d.mts.map +1 -0
- package/dist/lib/vfs.mjs +1102 -0
- package/dist/lib/vfs.mjs.map +1 -0
- package/dist/plugin-base.cjs +1 -1
- package/dist/plugin-base.mjs +1 -1
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-utils/build-helpers.cjs +2 -2
- package/dist/plugin-utils/build-helpers.mjs +2 -2
- package/dist/plugin-utils/build-helpers.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +22 -12
- package/dist/plugin-utils/context-helpers.d.cts +9 -1
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +9 -1
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +22 -13
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +13 -5
- package/dist/plugin-utils/filter.d.cts +2 -1
- package/dist/plugin-utils/filter.d.cts.map +1 -1
- package/dist/plugin-utils/filter.d.mts +2 -1
- package/dist/plugin-utils/filter.d.mts.map +1 -1
- package/dist/plugin-utils/filter.mjs +13 -6
- package/dist/plugin-utils/filter.mjs.map +1 -1
- package/dist/plugin-utils/format.cjs +44 -0
- package/dist/plugin-utils/format.d.cts +11 -0
- package/dist/plugin-utils/format.d.cts.map +1 -0
- package/dist/plugin-utils/format.d.mts +11 -0
- package/dist/plugin-utils/format.d.mts.map +1 -0
- package/dist/plugin-utils/format.mjs +43 -0
- package/dist/plugin-utils/format.mjs.map +1 -0
- package/dist/plugin-utils/helpers.cjs +6 -6
- package/dist/plugin-utils/helpers.d.cts +15 -15
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +15 -15
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +1 -1
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +34 -4
- package/dist/plugin-utils/index.d.cts +7 -4
- package/dist/plugin-utils/index.d.mts +7 -4
- package/dist/plugin-utils/index.mjs +9 -6
- package/dist/plugin-utils/install.cjs +47 -0
- package/dist/plugin-utils/install.d.cts +23 -0
- package/dist/plugin-utils/install.d.cts.map +1 -0
- package/dist/plugin-utils/install.d.mts +23 -0
- package/dist/plugin-utils/install.d.mts.map +1 -0
- package/dist/plugin-utils/install.mjs +45 -0
- package/dist/plugin-utils/install.mjs.map +1 -0
- package/dist/plugin-utils/logging.cjs +588 -1
- package/dist/plugin-utils/logging.d.cts +93 -1
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +93 -1
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +572 -1
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +1 -1
- package/dist/plugin-utils/merge.mjs +1 -1
- package/dist/plugin-utils/modules.cjs +1 -1
- package/dist/plugin-utils/modules.mjs +1 -1
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +6 -2
- package/dist/plugin-utils/paths.mjs +6 -2
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/plugin-utils/virtual.cjs +80 -0
- package/dist/plugin-utils/virtual.d.cts +69 -0
- package/dist/plugin-utils/virtual.d.cts.map +1 -0
- package/dist/plugin-utils/virtual.d.mts +69 -0
- package/dist/plugin-utils/virtual.d.mts.map +1 -0
- package/dist/plugin-utils/virtual.mjs +73 -0
- package/dist/plugin-utils/virtual.mjs.map +1 -0
- package/dist/schemas/fs.cjs +232 -0
- package/dist/schemas/fs.d.cts +127 -0
- package/dist/schemas/fs.d.cts.map +1 -0
- package/dist/schemas/fs.d.mts +127 -0
- package/dist/schemas/fs.d.mts.map +1 -0
- package/dist/schemas/fs.mjs +226 -0
- package/dist/schemas/fs.mjs.map +1 -0
- package/dist/storage/base.cjs +216 -0
- package/dist/storage/base.d.cts +201 -0
- package/dist/storage/base.d.cts.map +1 -0
- package/dist/storage/base.d.mts +201 -0
- package/dist/storage/base.d.mts.map +1 -0
- package/dist/storage/base.mjs +215 -0
- package/dist/storage/base.mjs.map +1 -0
- package/dist/storage/file-system.cjs +180 -0
- package/dist/storage/file-system.d.cts +129 -0
- package/dist/storage/file-system.d.cts.map +1 -0
- package/dist/storage/file-system.d.mts +129 -0
- package/dist/storage/file-system.d.mts.map +1 -0
- package/dist/storage/file-system.mjs +179 -0
- package/dist/storage/file-system.mjs.map +1 -0
- package/dist/storage/helpers.cjs +37 -0
- package/dist/storage/helpers.d.cts +25 -0
- package/dist/storage/helpers.d.cts.map +1 -0
- package/dist/storage/helpers.d.mts +25 -0
- package/dist/storage/helpers.d.mts.map +1 -0
- package/dist/storage/helpers.mjs +34 -0
- package/dist/storage/helpers.mjs.map +1 -0
- package/dist/storage/index.cjs +12 -0
- package/dist/storage/index.d.cts +5 -0
- package/dist/storage/index.d.mts +5 -0
- package/dist/storage/index.mjs +6 -0
- package/dist/storage/virtual.cjs +98 -0
- package/dist/storage/virtual.d.cts +80 -0
- package/dist/storage/virtual.d.cts.map +1 -0
- package/dist/storage/virtual.d.mts +80 -0
- package/dist/storage/virtual.d.mts.map +1 -0
- package/dist/storage/virtual.mjs +97 -0
- package/dist/storage/virtual.mjs.map +1 -0
- package/dist/types/api.d.cts +18 -152
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +18 -152
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +194 -135
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +195 -136
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +152 -128
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +155 -131
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.mts +1 -1
- package/dist/types/index.d.cts +5 -6
- package/dist/types/index.d.mts +5 -6
- package/dist/types/logging.d.cts +161 -0
- package/dist/types/logging.d.cts.map +1 -0
- package/dist/types/logging.d.mts +161 -0
- package/dist/types/logging.d.mts.map +1 -0
- package/dist/types/plugin.d.cts +6 -9
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +6 -9
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.mts +1 -1
- package/dist/types/unplugin.d.cts +5 -26
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +5 -26
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +259 -457
- package/schemas/fs.capnp +42 -0
- package/dist/constants/virtual-modules.cjs +0 -8
- package/dist/constants/virtual-modules.d.cts +0 -6
- package/dist/constants/virtual-modules.d.cts.map +0 -1
- package/dist/constants/virtual-modules.d.mts +0 -6
- package/dist/constants/virtual-modules.d.mts.map +0 -1
- package/dist/constants/virtual-modules.mjs +0 -7
- package/dist/constants/virtual-modules.mjs.map +0 -1
- package/dist/lib/logger.cjs +0 -99
- package/dist/lib/logger.d.cts +0 -53
- package/dist/lib/logger.d.cts.map +0 -1
- package/dist/lib/logger.d.mts +0 -53
- package/dist/lib/logger.d.mts.map +0 -1
- package/dist/lib/logger.mjs +0 -93
- package/dist/lib/logger.mjs.map +0 -1
- package/dist/types/_internal.cjs +0 -0
- package/dist/types/_internal.d.cts +0 -106
- package/dist/types/_internal.d.cts.map +0 -1
- package/dist/types/_internal.d.mts +0 -106
- package/dist/types/_internal.d.mts.map +0 -1
- package/dist/types/_internal.mjs +0 -1
- package/dist/types/commands.d.cts +0 -16
- package/dist/types/commands.d.cts.map +0 -1
- package/dist/types/commands.d.mts +0 -16
- package/dist/types/commands.d.mts.map +0 -1
- package/dist/types/utils.d.cts +0 -9
- package/dist/types/utils.d.cts.map +0 -1
- package/dist/types/utils.d.mts +0 -9
- package/dist/types/utils.d.mts.map +0 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { ResolveOptions, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "../types/fs.cjs";
|
|
2
|
+
import { Context } from "../types/context.cjs";
|
|
3
|
+
import { AssetGlob } from "@stryke/types/file";
|
|
4
|
+
import { FlatCache } from "flat-cache";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/vfs.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Represents a virtual file system (VFS) that stores files and their associated metadata in virtual memory.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This class provides methods to manage virtual files, check their existence, retrieve their content, and manipulate the virtual file system. It allows for efficient file management and retrieval without relying on the actual file system.
|
|
12
|
+
*/
|
|
13
|
+
declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
14
|
+
#private;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
19
|
+
* @returns A promise that resolves to a new virtual file system instance.
|
|
20
|
+
*/
|
|
21
|
+
static create(context: Context): Promise<VirtualFileSystem>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
26
|
+
* @returns A new virtual file system instance.
|
|
27
|
+
*/
|
|
28
|
+
static createSync(context: Context): VirtualFileSystem;
|
|
29
|
+
/**
|
|
30
|
+
* A map of file ids to their metadata.
|
|
31
|
+
*/
|
|
32
|
+
get metadata(): Record<string, VirtualFileMetadata>;
|
|
33
|
+
/**
|
|
34
|
+
* A map of file paths to their module ids.
|
|
35
|
+
*/
|
|
36
|
+
get ids(): Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* A map of module ids to their file paths.
|
|
39
|
+
*/
|
|
40
|
+
get paths(): Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the resolver cache.
|
|
43
|
+
*/
|
|
44
|
+
protected get resolverCache(): FlatCache;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
47
|
+
*
|
|
48
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
49
|
+
* @param fs - A buffer containing the serialized virtual file system data.
|
|
50
|
+
*/
|
|
51
|
+
private constructor();
|
|
52
|
+
/**
|
|
53
|
+
* Asynchronously checks if a file exists in the virtual file system (VFS).
|
|
54
|
+
*
|
|
55
|
+
* @param path - The path to the file.
|
|
56
|
+
* @returns A promise that resolves to `true` if the file exists, otherwise `false`.
|
|
57
|
+
*/
|
|
58
|
+
exists(path: string): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
61
|
+
*
|
|
62
|
+
* @param path - The path to the file.
|
|
63
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
64
|
+
*/
|
|
65
|
+
existsSync(path: string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if a file is virtual in the virtual file system (VFS).
|
|
68
|
+
*
|
|
69
|
+
* @param path - The path to the file.
|
|
70
|
+
* @param importer - An optional path to the importer module.
|
|
71
|
+
* @param options - Additional resolution options.
|
|
72
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
73
|
+
*/
|
|
74
|
+
isVirtual(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
77
|
+
*
|
|
78
|
+
* @param path - The path to check.
|
|
79
|
+
* @param importer - An optional path to the importer module.
|
|
80
|
+
* @param options - Additional resolution options.
|
|
81
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
82
|
+
*/
|
|
83
|
+
isDirectorySync(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
86
|
+
*
|
|
87
|
+
* @param path - The path to check.
|
|
88
|
+
* @param importer - An optional path to the importer module.
|
|
89
|
+
* @param options - Additional resolution options.
|
|
90
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
91
|
+
*/
|
|
92
|
+
isDirectory(path: string, importer?: string | undefined, options?: ResolveOptions): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
95
|
+
*
|
|
96
|
+
* @param path - The path to check.
|
|
97
|
+
* @param importer - An optional path to the importer module.
|
|
98
|
+
* @param options - Additional resolution options.
|
|
99
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
100
|
+
*/
|
|
101
|
+
isFileSync(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
104
|
+
*
|
|
105
|
+
* @param path - The path to check.
|
|
106
|
+
* @param importer - An optional path to the importer module.
|
|
107
|
+
* @param options - Additional resolution options.
|
|
108
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
109
|
+
*/
|
|
110
|
+
isFile(path: string, importer?: string | undefined, options?: ResolveOptions): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Checks if a file Id must be resolved by the virtual file system (VFS).
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Examples of file Ids that would be considered virtual include:
|
|
116
|
+
* - Ids that start with the framework specific prefix (e.g. `powerlines:`)
|
|
117
|
+
* - Ids that match a configured alias for virtual modules (returned true from {@link VirtualFileSystemInterface.isVirtual})
|
|
118
|
+
*
|
|
119
|
+
* @param path - The path or id of the file.
|
|
120
|
+
* @param importer - An optional path to the importer module, used for resolving the file path.
|
|
121
|
+
* @param options - Additional options for resolving the file path.
|
|
122
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
123
|
+
*/
|
|
124
|
+
isResolvableId(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Lists files in a given path.
|
|
127
|
+
*
|
|
128
|
+
* @param path - The path to list files from.
|
|
129
|
+
* @returns An array of file names in the specified path.
|
|
130
|
+
*/
|
|
131
|
+
listSync(path: string): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Lists files in a given path.
|
|
134
|
+
*
|
|
135
|
+
* @param path - The path to list files from.
|
|
136
|
+
* @returns An array of file names in the specified path.
|
|
137
|
+
*/
|
|
138
|
+
list(path: string): Promise<string[]>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes a file in the virtual file system (VFS).
|
|
141
|
+
*
|
|
142
|
+
* @param path - The path to create the directory at.
|
|
143
|
+
*/
|
|
144
|
+
remove(path: string): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Removes a file in the virtual file system (VFS).
|
|
147
|
+
*
|
|
148
|
+
* @param path - The path to create the directory at.
|
|
149
|
+
*/
|
|
150
|
+
removeSync(path: string): void;
|
|
151
|
+
/**
|
|
152
|
+
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
153
|
+
*
|
|
154
|
+
* @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
155
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
156
|
+
*/
|
|
157
|
+
glob(patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]): Promise<string[]>;
|
|
158
|
+
/**
|
|
159
|
+
* Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
160
|
+
*
|
|
161
|
+
* @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
162
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
163
|
+
*/
|
|
164
|
+
globSync(patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]): string[];
|
|
165
|
+
/**
|
|
166
|
+
* Copies a file from one path to another in the virtual file system (VFS).
|
|
167
|
+
*
|
|
168
|
+
* @param srcPath - The source path to copy
|
|
169
|
+
* @param destPath - The destination path to copy to
|
|
170
|
+
*/
|
|
171
|
+
copy(srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Synchronously copies a file from one path to another in the virtual file system (VFS).
|
|
174
|
+
*
|
|
175
|
+
* @param srcPath - The source path to copy
|
|
176
|
+
* @param destPath - The destination path to copy to
|
|
177
|
+
*/
|
|
178
|
+
copySync(srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL): void;
|
|
179
|
+
/**
|
|
180
|
+
* Moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
181
|
+
*
|
|
182
|
+
* @param srcPath - The source path to move
|
|
183
|
+
* @param destPath - The destination path to move to
|
|
184
|
+
*/
|
|
185
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
188
|
+
*
|
|
189
|
+
* @param srcPath - The source path to move
|
|
190
|
+
* @param destPath - The destination path to move to
|
|
191
|
+
*/
|
|
192
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
193
|
+
/**
|
|
194
|
+
* Asynchronously reads a file from the virtual file system (VFS).
|
|
195
|
+
*
|
|
196
|
+
* @param path - The path or ID of the file to read.
|
|
197
|
+
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
198
|
+
*/
|
|
199
|
+
read(path: string): Promise<string | undefined>;
|
|
200
|
+
/**
|
|
201
|
+
* Synchronously reads a file from the virtual file system (VFS).
|
|
202
|
+
*
|
|
203
|
+
* @param path - The path or ID of the file to read.
|
|
204
|
+
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
205
|
+
*/
|
|
206
|
+
readSync(path: string): string | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Writes a file to the virtual file system (VFS).
|
|
209
|
+
*
|
|
210
|
+
* @param path - The path to the file.
|
|
211
|
+
* @param data - The contents of the file.
|
|
212
|
+
* @param options - Optional parameters for writing the file.
|
|
213
|
+
* @returns A promise that resolves when the file is written.
|
|
214
|
+
*/
|
|
215
|
+
write(path: string, data?: string, options?: WriteOptions): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Synchronously writes a file to the virtual file system (VFS).
|
|
218
|
+
*
|
|
219
|
+
* @param path - The file to write.
|
|
220
|
+
* @param data - The contents of the file.
|
|
221
|
+
* @param options - Optional parameters for writing the file.
|
|
222
|
+
*/
|
|
223
|
+
writeSync(path: string, data?: string, options?: WriteOptions): void;
|
|
224
|
+
/**
|
|
225
|
+
* Synchronously creates a directory at the specified path.
|
|
226
|
+
*
|
|
227
|
+
* @param dirPath - The path of the directory to create.
|
|
228
|
+
*/
|
|
229
|
+
mkdirSync(dirPath: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a directory at the specified path.
|
|
232
|
+
*
|
|
233
|
+
* @param path - The path of the directory to create.
|
|
234
|
+
*/
|
|
235
|
+
mkdir(path: string): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
238
|
+
*
|
|
239
|
+
* @param pathOrId - The path or ID of the file to retrieve metadata for.
|
|
240
|
+
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
241
|
+
*/
|
|
242
|
+
getMetadata(pathOrId: string): VirtualFileMetadata | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* Resolves a given module ID using the configured aliases.
|
|
245
|
+
*
|
|
246
|
+
* @remarks
|
|
247
|
+
* This function can be used to map module IDs to different paths based on the alias configuration.
|
|
248
|
+
*
|
|
249
|
+
* @param id - The module ID to resolve.
|
|
250
|
+
* @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
|
|
251
|
+
*/
|
|
252
|
+
resolveAlias(id: string): string;
|
|
253
|
+
/**
|
|
254
|
+
* Checks if a given module ID is an alias.
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
* This function can be used to determine if a module ID matches any configured aliases.
|
|
258
|
+
*
|
|
259
|
+
* @param id - The module ID to check.
|
|
260
|
+
* @returns A boolean indicating whether the module ID is an alias.
|
|
261
|
+
*/
|
|
262
|
+
isAlias(id: string): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Checks if a given module ID is a tsconfig path.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* This function can be used to determine if a module ID matches any configured tsconfig paths.
|
|
268
|
+
*
|
|
269
|
+
* @param id - The module ID to check.
|
|
270
|
+
* @returns A boolean indicating whether the module ID is a tsconfig path.
|
|
271
|
+
*/
|
|
272
|
+
isTsconfigPath(id: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @param id - The module to resolve.
|
|
285
|
+
* @param importer - An optional path to the importer module.
|
|
286
|
+
* @param options - Additional resolution options.
|
|
287
|
+
* @returns A promise that resolves to the resolved module path.
|
|
288
|
+
*/
|
|
289
|
+
resolve(id: string, importer?: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
290
|
+
/**
|
|
291
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
292
|
+
*
|
|
293
|
+
* @remarks
|
|
294
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @param id - The module to resolve.
|
|
302
|
+
* @param importer - An optional path to the importer module.
|
|
303
|
+
* @param options - Additional resolution options.
|
|
304
|
+
* @returns The resolved module path.
|
|
305
|
+
*/
|
|
306
|
+
resolveSync(id: string, importer?: string, options?: ResolveOptions): string | undefined;
|
|
307
|
+
/**
|
|
308
|
+
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
309
|
+
*/
|
|
310
|
+
dispose(): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Asynchronously disposes of the virtual file system (VFS) by saving its state to disk.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* This method is automatically called when the VFS instance is used within a `using` block, or can be manually invoked to ensure that the VFS state is saved and resources are cleaned up properly.
|
|
316
|
+
*/
|
|
317
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
export { VirtualFileSystem };
|
|
321
|
+
//# sourceMappingURL=vfs.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vfs.d.cts","names":[],"sources":["../../src/lib/vfs.ts"],"mappings":"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"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { ResolveOptions, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "../types/fs.mjs";
|
|
2
|
+
import { Context } from "../types/context.mjs";
|
|
3
|
+
import { FlatCache } from "flat-cache";
|
|
4
|
+
import { AssetGlob } from "@stryke/types/file";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/vfs.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Represents a virtual file system (VFS) that stores files and their associated metadata in virtual memory.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This class provides methods to manage virtual files, check their existence, retrieve their content, and manipulate the virtual file system. It allows for efficient file management and retrieval without relying on the actual file system.
|
|
12
|
+
*/
|
|
13
|
+
declare class VirtualFileSystem implements VirtualFileSystemInterface {
|
|
14
|
+
#private;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
19
|
+
* @returns A promise that resolves to a new virtual file system instance.
|
|
20
|
+
*/
|
|
21
|
+
static create(context: Context): Promise<VirtualFileSystem>;
|
|
22
|
+
/**
|
|
23
|
+
* Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
26
|
+
* @returns A new virtual file system instance.
|
|
27
|
+
*/
|
|
28
|
+
static createSync(context: Context): VirtualFileSystem;
|
|
29
|
+
/**
|
|
30
|
+
* A map of file ids to their metadata.
|
|
31
|
+
*/
|
|
32
|
+
get metadata(): Record<string, VirtualFileMetadata>;
|
|
33
|
+
/**
|
|
34
|
+
* A map of file paths to their module ids.
|
|
35
|
+
*/
|
|
36
|
+
get ids(): Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* A map of module ids to their file paths.
|
|
39
|
+
*/
|
|
40
|
+
get paths(): Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the resolver cache.
|
|
43
|
+
*/
|
|
44
|
+
protected get resolverCache(): FlatCache;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
47
|
+
*
|
|
48
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
49
|
+
* @param fs - A buffer containing the serialized virtual file system data.
|
|
50
|
+
*/
|
|
51
|
+
private constructor();
|
|
52
|
+
/**
|
|
53
|
+
* Asynchronously checks if a file exists in the virtual file system (VFS).
|
|
54
|
+
*
|
|
55
|
+
* @param path - The path to the file.
|
|
56
|
+
* @returns A promise that resolves to `true` if the file exists, otherwise `false`.
|
|
57
|
+
*/
|
|
58
|
+
exists(path: string): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
61
|
+
*
|
|
62
|
+
* @param path - The path to the file.
|
|
63
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
64
|
+
*/
|
|
65
|
+
existsSync(path: string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if a file is virtual in the virtual file system (VFS).
|
|
68
|
+
*
|
|
69
|
+
* @param path - The path to the file.
|
|
70
|
+
* @param importer - An optional path to the importer module.
|
|
71
|
+
* @param options - Additional resolution options.
|
|
72
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
73
|
+
*/
|
|
74
|
+
isVirtual(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
77
|
+
*
|
|
78
|
+
* @param path - The path to check.
|
|
79
|
+
* @param importer - An optional path to the importer module.
|
|
80
|
+
* @param options - Additional resolution options.
|
|
81
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
82
|
+
*/
|
|
83
|
+
isDirectorySync(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
86
|
+
*
|
|
87
|
+
* @param path - The path to check.
|
|
88
|
+
* @param importer - An optional path to the importer module.
|
|
89
|
+
* @param options - Additional resolution options.
|
|
90
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
91
|
+
*/
|
|
92
|
+
isDirectory(path: string, importer?: string | undefined, options?: ResolveOptions): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
95
|
+
*
|
|
96
|
+
* @param path - The path to check.
|
|
97
|
+
* @param importer - An optional path to the importer module.
|
|
98
|
+
* @param options - Additional resolution options.
|
|
99
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
100
|
+
*/
|
|
101
|
+
isFileSync(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
104
|
+
*
|
|
105
|
+
* @param path - The path to check.
|
|
106
|
+
* @param importer - An optional path to the importer module.
|
|
107
|
+
* @param options - Additional resolution options.
|
|
108
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
109
|
+
*/
|
|
110
|
+
isFile(path: string, importer?: string | undefined, options?: ResolveOptions): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Checks if a file Id must be resolved by the virtual file system (VFS).
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Examples of file Ids that would be considered virtual include:
|
|
116
|
+
* - Ids that start with the framework specific prefix (e.g. `powerlines:`)
|
|
117
|
+
* - Ids that match a configured alias for virtual modules (returned true from {@link VirtualFileSystemInterface.isVirtual})
|
|
118
|
+
*
|
|
119
|
+
* @param path - The path or id of the file.
|
|
120
|
+
* @param importer - An optional path to the importer module, used for resolving the file path.
|
|
121
|
+
* @param options - Additional options for resolving the file path.
|
|
122
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
123
|
+
*/
|
|
124
|
+
isResolvableId(path: string, importer?: string | undefined, options?: ResolveOptions): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Lists files in a given path.
|
|
127
|
+
*
|
|
128
|
+
* @param path - The path to list files from.
|
|
129
|
+
* @returns An array of file names in the specified path.
|
|
130
|
+
*/
|
|
131
|
+
listSync(path: string): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Lists files in a given path.
|
|
134
|
+
*
|
|
135
|
+
* @param path - The path to list files from.
|
|
136
|
+
* @returns An array of file names in the specified path.
|
|
137
|
+
*/
|
|
138
|
+
list(path: string): Promise<string[]>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes a file in the virtual file system (VFS).
|
|
141
|
+
*
|
|
142
|
+
* @param path - The path to create the directory at.
|
|
143
|
+
*/
|
|
144
|
+
remove(path: string): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Removes a file in the virtual file system (VFS).
|
|
147
|
+
*
|
|
148
|
+
* @param path - The path to create the directory at.
|
|
149
|
+
*/
|
|
150
|
+
removeSync(path: string): void;
|
|
151
|
+
/**
|
|
152
|
+
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
153
|
+
*
|
|
154
|
+
* @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
155
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
156
|
+
*/
|
|
157
|
+
glob(patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]): Promise<string[]>;
|
|
158
|
+
/**
|
|
159
|
+
* Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
160
|
+
*
|
|
161
|
+
* @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
|
|
162
|
+
* @returns An array of file paths matching the provided pattern(s)
|
|
163
|
+
*/
|
|
164
|
+
globSync(patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]): string[];
|
|
165
|
+
/**
|
|
166
|
+
* Copies a file from one path to another in the virtual file system (VFS).
|
|
167
|
+
*
|
|
168
|
+
* @param srcPath - The source path to copy
|
|
169
|
+
* @param destPath - The destination path to copy to
|
|
170
|
+
*/
|
|
171
|
+
copy(srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Synchronously copies a file from one path to another in the virtual file system (VFS).
|
|
174
|
+
*
|
|
175
|
+
* @param srcPath - The source path to copy
|
|
176
|
+
* @param destPath - The destination path to copy to
|
|
177
|
+
*/
|
|
178
|
+
copySync(srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL): void;
|
|
179
|
+
/**
|
|
180
|
+
* Moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
181
|
+
*
|
|
182
|
+
* @param srcPath - The source path to move
|
|
183
|
+
* @param destPath - The destination path to move to
|
|
184
|
+
*/
|
|
185
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
188
|
+
*
|
|
189
|
+
* @param srcPath - The source path to move
|
|
190
|
+
* @param destPath - The destination path to move to
|
|
191
|
+
*/
|
|
192
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
193
|
+
/**
|
|
194
|
+
* Asynchronously reads a file from the virtual file system (VFS).
|
|
195
|
+
*
|
|
196
|
+
* @param path - The path or ID of the file to read.
|
|
197
|
+
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
198
|
+
*/
|
|
199
|
+
read(path: string): Promise<string | undefined>;
|
|
200
|
+
/**
|
|
201
|
+
* Synchronously reads a file from the virtual file system (VFS).
|
|
202
|
+
*
|
|
203
|
+
* @param path - The path or ID of the file to read.
|
|
204
|
+
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
205
|
+
*/
|
|
206
|
+
readSync(path: string): string | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Writes a file to the virtual file system (VFS).
|
|
209
|
+
*
|
|
210
|
+
* @param path - The path to the file.
|
|
211
|
+
* @param data - The contents of the file.
|
|
212
|
+
* @param options - Optional parameters for writing the file.
|
|
213
|
+
* @returns A promise that resolves when the file is written.
|
|
214
|
+
*/
|
|
215
|
+
write(path: string, data?: string, options?: WriteOptions): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Synchronously writes a file to the virtual file system (VFS).
|
|
218
|
+
*
|
|
219
|
+
* @param path - The file to write.
|
|
220
|
+
* @param data - The contents of the file.
|
|
221
|
+
* @param options - Optional parameters for writing the file.
|
|
222
|
+
*/
|
|
223
|
+
writeSync(path: string, data?: string, options?: WriteOptions): void;
|
|
224
|
+
/**
|
|
225
|
+
* Synchronously creates a directory at the specified path.
|
|
226
|
+
*
|
|
227
|
+
* @param dirPath - The path of the directory to create.
|
|
228
|
+
*/
|
|
229
|
+
mkdirSync(dirPath: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a directory at the specified path.
|
|
232
|
+
*
|
|
233
|
+
* @param path - The path of the directory to create.
|
|
234
|
+
*/
|
|
235
|
+
mkdir(path: string): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
238
|
+
*
|
|
239
|
+
* @param pathOrId - The path or ID of the file to retrieve metadata for.
|
|
240
|
+
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
241
|
+
*/
|
|
242
|
+
getMetadata(pathOrId: string): VirtualFileMetadata | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* Resolves a given module ID using the configured aliases.
|
|
245
|
+
*
|
|
246
|
+
* @remarks
|
|
247
|
+
* This function can be used to map module IDs to different paths based on the alias configuration.
|
|
248
|
+
*
|
|
249
|
+
* @param id - The module ID to resolve.
|
|
250
|
+
* @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
|
|
251
|
+
*/
|
|
252
|
+
resolveAlias(id: string): string;
|
|
253
|
+
/**
|
|
254
|
+
* Checks if a given module ID is an alias.
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
* This function can be used to determine if a module ID matches any configured aliases.
|
|
258
|
+
*
|
|
259
|
+
* @param id - The module ID to check.
|
|
260
|
+
* @returns A boolean indicating whether the module ID is an alias.
|
|
261
|
+
*/
|
|
262
|
+
isAlias(id: string): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Checks if a given module ID is a tsconfig path.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* This function can be used to determine if a module ID matches any configured tsconfig paths.
|
|
268
|
+
*
|
|
269
|
+
* @param id - The module ID to check.
|
|
270
|
+
* @returns A boolean indicating whether the module ID is a tsconfig path.
|
|
271
|
+
*/
|
|
272
|
+
isTsconfigPath(id: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts
|
|
281
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @param id - The module to resolve.
|
|
285
|
+
* @param importer - An optional path to the importer module.
|
|
286
|
+
* @param options - Additional resolution options.
|
|
287
|
+
* @returns A promise that resolves to the resolved module path.
|
|
288
|
+
*/
|
|
289
|
+
resolve(id: string, importer?: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
290
|
+
/**
|
|
291
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
292
|
+
*
|
|
293
|
+
* @remarks
|
|
294
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @param id - The module to resolve.
|
|
302
|
+
* @param importer - An optional path to the importer module.
|
|
303
|
+
* @param options - Additional resolution options.
|
|
304
|
+
* @returns The resolved module path.
|
|
305
|
+
*/
|
|
306
|
+
resolveSync(id: string, importer?: string, options?: ResolveOptions): string | undefined;
|
|
307
|
+
/**
|
|
308
|
+
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
309
|
+
*/
|
|
310
|
+
dispose(): Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Asynchronously disposes of the virtual file system (VFS) by saving its state to disk.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* This method is automatically called when the VFS instance is used within a `using` block, or can be manually invoked to ensure that the VFS state is saved and resources are cleaned up properly.
|
|
316
|
+
*/
|
|
317
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
export { VirtualFileSystem };
|
|
321
|
+
//# sourceMappingURL=vfs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vfs.d.mts","names":[],"sources":["../../src/lib/vfs.ts"],"mappings":"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"}
|