@breadstone-infrastructure/utilities 0.0.12-beta.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/Cli/Abstracts/ProgramCommandBase.d.ts +60 -0
- package/Cli/Abstracts/ProgramCommandBase.d.ts.map +1 -0
- package/Cli/Abstracts/ProgramCommandBase.js +64 -0
- package/Cli/Abstracts/ProgramCommandBase.js.map +1 -0
- package/Cli/Builders/ProgramBuilder.d.ts +39 -0
- package/Cli/Builders/ProgramBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramBuilder.js +73 -0
- package/Cli/Builders/ProgramBuilder.js.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts +78 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.js +147 -0
- package/Cli/Builders/ProgramCommandBuilder.js.map +1 -0
- package/Cli/Interfaces/IProgramArg.d.ts +11 -0
- package/Cli/Interfaces/IProgramArg.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArg.js +4 -0
- package/Cli/Interfaces/IProgramArg.js.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts +9 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.js +4 -0
- package/Cli/Interfaces/IProgramArgOptions.js.map +1 -0
- package/Cli/Interfaces/IProgramArgs.d.ts +27 -0
- package/Cli/Interfaces/IProgramArgs.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgs.js +4 -0
- package/Cli/Interfaces/IProgramArgs.js.map +1 -0
- package/Cli/Interfaces/IProgramCommand.d.ts +53 -0
- package/Cli/Interfaces/IProgramCommand.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommand.js +4 -0
- package/Cli/Interfaces/IProgramCommand.js.map +1 -0
- package/Cli/Interfaces/IProgramCommands.d.ts +47 -0
- package/Cli/Interfaces/IProgramCommands.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommands.js +4 -0
- package/Cli/Interfaces/IProgramCommands.js.map +1 -0
- package/Cli/Interfaces/IProgramConfig.d.ts +10 -0
- package/Cli/Interfaces/IProgramConfig.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramConfig.js +3 -0
- package/Cli/Interfaces/IProgramConfig.js.map +1 -0
- package/Cli/Interfaces/IProgramInit.d.ts +14 -0
- package/Cli/Interfaces/IProgramInit.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramInit.js +3 -0
- package/Cli/Interfaces/IProgramInit.js.map +1 -0
- package/Cli/Program.d.ts +97 -0
- package/Cli/Program.d.ts.map +1 -0
- package/Cli/Program.js +217 -0
- package/Cli/Program.js.map +1 -0
- package/Cli/ProgramArgs.d.ts +39 -0
- package/Cli/ProgramArgs.d.ts.map +1 -0
- package/Cli/ProgramArgs.js +83 -0
- package/Cli/ProgramArgs.js.map +1 -0
- package/Cli/ProgramCommandResult.d.ts +13 -0
- package/Cli/ProgramCommandResult.d.ts.map +1 -0
- package/Cli/ProgramCommandResult.js +3 -0
- package/Cli/ProgramCommandResult.js.map +1 -0
- package/Cli/ProgramCommands.d.ts +66 -0
- package/Cli/ProgramCommands.d.ts.map +1 -0
- package/Cli/ProgramCommands.js +173 -0
- package/Cli/ProgramCommands.js.map +1 -0
- package/Cli/ProgramConfig.d.ts +24 -0
- package/Cli/ProgramConfig.d.ts.map +1 -0
- package/Cli/ProgramConfig.js +51 -0
- package/Cli/ProgramConfig.js.map +1 -0
- package/Cli/ProgramDoneFn.d.ts +5 -0
- package/Cli/ProgramDoneFn.d.ts.map +1 -0
- package/Cli/ProgramDoneFn.js +3 -0
- package/Cli/ProgramDoneFn.js.map +1 -0
- package/Compiler/TypeScript.d.ts +19 -0
- package/Compiler/TypeScript.d.ts.map +1 -0
- package/Compiler/TypeScript.js +166 -0
- package/Compiler/TypeScript.js.map +1 -0
- package/DI/Container.d.ts +73 -0
- package/DI/Container.d.ts.map +1 -0
- package/DI/Container.js +143 -0
- package/DI/Container.js.map +1 -0
- package/DI/Inject.d.ts +11 -0
- package/DI/Inject.d.ts.map +1 -0
- package/DI/Inject.js +18 -0
- package/DI/Inject.js.map +1 -0
- package/Decorators/EnumerableDecorator.d.ts +6 -0
- package/Decorators/EnumerableDecorator.d.ts.map +1 -0
- package/Decorators/EnumerableDecorator.js +18 -0
- package/Decorators/EnumerableDecorator.js.map +1 -0
- package/Events/AsyncEventEmitter.d.ts +8 -0
- package/Events/AsyncEventEmitter.d.ts.map +1 -0
- package/Events/AsyncEventEmitter.js +37 -0
- package/Events/AsyncEventEmitter.js.map +1 -0
- package/IO/CustomElementManifest.d.ts +254 -0
- package/IO/CustomElementManifest.d.ts.map +1 -0
- package/IO/CustomElementManifest.js +56 -0
- package/IO/CustomElementManifest.js.map +1 -0
- package/IO/Directory.d.ts +78 -0
- package/IO/Directory.d.ts.map +1 -0
- package/IO/Directory.js +184 -0
- package/IO/Directory.js.map +1 -0
- package/IO/Encoding.d.ts +2 -0
- package/IO/Encoding.d.ts.map +1 -0
- package/IO/Encoding.js +3 -0
- package/IO/Encoding.js.map +1 -0
- package/IO/File.d.ts +148 -0
- package/IO/File.d.ts.map +1 -0
- package/IO/File.js +314 -0
- package/IO/File.js.map +1 -0
- package/IO/FileSystemInfo.d.ts +46 -0
- package/IO/FileSystemInfo.d.ts.map +1 -0
- package/IO/FileSystemInfo.js +129 -0
- package/IO/FileSystemInfo.js.map +1 -0
- package/IO/FileSystemWatcher.d.ts +49 -0
- package/IO/FileSystemWatcher.d.ts.map +1 -0
- package/IO/FileSystemWatcher.js +93 -0
- package/IO/FileSystemWatcher.js.map +1 -0
- package/IO/Glob.d.ts +35 -0
- package/IO/Glob.d.ts.map +1 -0
- package/IO/Glob.js +152 -0
- package/IO/Glob.js.map +1 -0
- package/IO/Json.d.ts +84 -0
- package/IO/Json.d.ts.map +1 -0
- package/IO/Json.js +114 -0
- package/IO/Json.js.map +1 -0
- package/IO/Path.d.ts +125 -0
- package/IO/Path.d.ts.map +1 -0
- package/IO/Path.js +283 -0
- package/IO/Path.js.map +1 -0
- package/IO/PcfControlManifest.d.ts +79 -0
- package/IO/PcfControlManifest.d.ts.map +1 -0
- package/IO/PcfControlManifest.js +93 -0
- package/IO/PcfControlManifest.js.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts +30 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.js +3 -0
- package/IO/Reader/Interfaces/IFileReader.js.map +1 -0
- package/IO/Reader/TextFileReader.d.ts +53 -0
- package/IO/Reader/TextFileReader.d.ts.map +1 -0
- package/IO/Reader/TextFileReader.js +167 -0
- package/IO/Reader/TextFileReader.js.map +1 -0
- package/IO/Resx.d.ts +49 -0
- package/IO/Resx.d.ts.map +1 -0
- package/IO/Resx.js +95 -0
- package/IO/Resx.js.map +1 -0
- package/IO/SymbolikLink.d.ts +6 -0
- package/IO/SymbolikLink.d.ts.map +1 -0
- package/IO/SymbolikLink.js +10 -0
- package/IO/SymbolikLink.js.map +1 -0
- package/IO/Template.d.ts +41 -0
- package/IO/Template.d.ts.map +1 -0
- package/IO/Template.js +71 -0
- package/IO/Template.js.map +1 -0
- package/IO/TemporaryDirectory.d.ts +28 -0
- package/IO/TemporaryDirectory.d.ts.map +1 -0
- package/IO/TemporaryDirectory.js +76 -0
- package/IO/TemporaryDirectory.js.map +1 -0
- package/IO/TemporaryFile.d.ts +28 -0
- package/IO/TemporaryFile.d.ts.map +1 -0
- package/IO/TemporaryFile.js +77 -0
- package/IO/TemporaryFile.js.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts +31 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.js +4 -0
- package/IO/Writer/Interfaces/IFileWriter.js.map +1 -0
- package/IO/Writer/TextFileWriter.d.ts +56 -0
- package/IO/Writer/TextFileWriter.d.ts.map +1 -0
- package/IO/Writer/TextFileWriter.js +129 -0
- package/IO/Writer/TextFileWriter.js.map +1 -0
- package/IO/vNext/FileCache.d.ts +46 -0
- package/IO/vNext/FileCache.d.ts.map +1 -0
- package/IO/vNext/FileCache.js +94 -0
- package/IO/vNext/FileCache.js.map +1 -0
- package/IO/vNext/FileSystem.d.ts +107 -0
- package/IO/vNext/FileSystem.d.ts.map +1 -0
- package/IO/vNext/FileSystem.js +148 -0
- package/IO/vNext/FileSystem.js.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts +56 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.js +3 -0
- package/IO/vNext/Interfaces/IFileCache.js.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts +102 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.js +4 -0
- package/IO/vNext/Interfaces/IFileSystem.js.map +1 -0
- package/Index.d.ts +62 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +132 -0
- package/Index.js.map +1 -0
- package/Intl/Languages.d.ts +12 -0
- package/Intl/Languages.d.ts.map +1 -0
- package/Intl/Languages.js +865 -0
- package/Intl/Languages.js.map +1 -0
- package/LICENSE +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts.map +1 -0
- package/Logging/Appenders/Abstracts/Appender.js +78 -0
- package/Logging/Appenders/Abstracts/Appender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts +13 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.js +4 -0
- package/Logging/Appenders/Interfaces/IAppender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts +9 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js +3 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js.map +1 -0
- package/Logging/Appenders/LogLevelAppender.d.ts +29 -0
- package/Logging/Appenders/LogLevelAppender.d.ts.map +1 -0
- package/Logging/Appenders/LogLevelAppender.js +102 -0
- package/Logging/Appenders/LogLevelAppender.js.map +1 -0
- package/Logging/Appenders/MessageAppender.d.ts +26 -0
- package/Logging/Appenders/MessageAppender.d.ts.map +1 -0
- package/Logging/Appenders/MessageAppender.js +91 -0
- package/Logging/Appenders/MessageAppender.js.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts +20 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js +4 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts +5 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js +3 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js.map +1 -0
- package/Logging/Appenders/TagAppender.d.ts +25 -0
- package/Logging/Appenders/TagAppender.d.ts.map +1 -0
- package/Logging/Appenders/TagAppender.js +49 -0
- package/Logging/Appenders/TagAppender.js.map +1 -0
- package/Logging/Appenders/TimeStampAppender.d.ts +22 -0
- package/Logging/Appenders/TimeStampAppender.d.ts.map +1 -0
- package/Logging/Appenders/TimeStampAppender.js +44 -0
- package/Logging/Appenders/TimeStampAppender.js.map +1 -0
- package/Logging/Interfaces/ILogEntry.d.ts +13 -0
- package/Logging/Interfaces/ILogEntry.d.ts.map +1 -0
- package/Logging/Interfaces/ILogEntry.js +4 -0
- package/Logging/Interfaces/ILogEntry.js.map +1 -0
- package/Logging/Interfaces/ILogOptions.d.ts +17 -0
- package/Logging/Interfaces/ILogOptions.d.ts.map +1 -0
- package/Logging/Interfaces/ILogOptions.js +4 -0
- package/Logging/Interfaces/ILogOptions.js.map +1 -0
- package/Logging/Interfaces/ILoggerScope.d.ts +7 -0
- package/Logging/Interfaces/ILoggerScope.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScope.js +3 -0
- package/Logging/Interfaces/ILoggerScope.js.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts +9 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js +4 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js.map +1 -0
- package/Logging/LogLevel.d.ts +5 -0
- package/Logging/LogLevel.d.ts.map +1 -0
- package/Logging/LogLevel.js +3 -0
- package/Logging/LogLevel.js.map +1 -0
- package/Logging/Logger.d.ts +148 -0
- package/Logging/Logger.d.ts.map +1 -0
- package/Logging/Logger.js +326 -0
- package/Logging/Logger.js.map +1 -0
- package/Logging/LoggerConfig.d.ts +45 -0
- package/Logging/LoggerConfig.d.ts.map +1 -0
- package/Logging/LoggerConfig.js +83 -0
- package/Logging/LoggerConfig.js.map +1 -0
- package/Logging/LoggerScope.d.ts +16 -0
- package/Logging/LoggerScope.d.ts.map +1 -0
- package/Logging/LoggerScope.js +81 -0
- package/Logging/LoggerScope.js.map +1 -0
- package/Logging/LoggerSuppressor.d.ts +10 -0
- package/Logging/LoggerSuppressor.d.ts.map +1 -0
- package/Logging/LoggerSuppressor.js +43 -0
- package/Logging/LoggerSuppressor.js.map +1 -0
- package/Logging/LoggerUtils.d.ts +47 -0
- package/Logging/LoggerUtils.d.ts.map +1 -0
- package/Logging/LoggerUtils.js +102 -0
- package/Logging/LoggerUtils.js.map +1 -0
- package/Logging/vNext/ConsoleLogger.d.ts +56 -0
- package/Logging/vNext/ConsoleLogger.d.ts.map +1 -0
- package/Logging/vNext/ConsoleLogger.js +76 -0
- package/Logging/vNext/ConsoleLogger.js.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts +38 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.js +3 -0
- package/Logging/vNext/Interfaces/ILogger.js.map +1 -0
- package/Logging/vNext/LoggerExtensions.d.ts +79 -0
- package/Logging/vNext/LoggerExtensions.d.ts.map +1 -0
- package/Logging/vNext/LoggerExtensions.js +175 -0
- package/Logging/vNext/LoggerExtensions.js.map +1 -0
- package/Logging/vNext/Styles/Style.d.ts +9 -0
- package/Logging/vNext/Styles/Style.d.ts.map +1 -0
- package/Logging/vNext/Styles/Style.js +17 -0
- package/Logging/vNext/Styles/Style.js.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts +61 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.js +118 -0
- package/Logging/vNext/Styles/StyleDirectives.js.map +1 -0
- package/System/Args.d.ts +20 -0
- package/System/Args.d.ts.map +1 -0
- package/System/Args.js +45 -0
- package/System/Args.js.map +1 -0
- package/System/Array.d.ts +41 -0
- package/System/Array.d.ts.map +1 -0
- package/System/Array.js +91 -0
- package/System/Array.js.map +1 -0
- package/System/Assign.d.ts +12 -0
- package/System/Assign.d.ts.map +1 -0
- package/System/Assign.js +40 -0
- package/System/Assign.js.map +1 -0
- package/System/Boolean.d.ts +20 -0
- package/System/Boolean.d.ts.map +1 -0
- package/System/Boolean.js +52 -0
- package/System/Boolean.js.map +1 -0
- package/System/Error.d.ts +9 -0
- package/System/Error.d.ts.map +1 -0
- package/System/Error.js +20 -0
- package/System/Error.js.map +1 -0
- package/System/Errors.d.ts +7 -0
- package/System/Errors.d.ts.map +1 -0
- package/System/Errors.js +18 -0
- package/System/Errors.js.map +1 -0
- package/System/Formatter.d.ts +4 -0
- package/System/Formatter.d.ts.map +1 -0
- package/System/Formatter.js +17 -0
- package/System/Formatter.js.map +1 -0
- package/System/Guard.d.ts +5 -0
- package/System/Guard.d.ts.map +1 -0
- package/System/Guard.js +29 -0
- package/System/Guard.js.map +1 -0
- package/System/Interfaces/IType.d.ts +7 -0
- package/System/Interfaces/IType.d.ts.map +1 -0
- package/System/Interfaces/IType.js +3 -0
- package/System/Interfaces/IType.js.map +1 -0
- package/System/Interfaces/IUnknown.d.ts +7 -0
- package/System/Interfaces/IUnknown.d.ts.map +1 -0
- package/System/Interfaces/IUnknown.js +3 -0
- package/System/Interfaces/IUnknown.js.map +1 -0
- package/System/List.d.ts +27 -0
- package/System/List.d.ts.map +1 -0
- package/System/List.js +84 -0
- package/System/List.js.map +1 -0
- package/System/Number.d.ts +10 -0
- package/System/Number.d.ts.map +1 -0
- package/System/Number.js +28 -0
- package/System/Number.js.map +1 -0
- package/System/Process.d.ts +30 -0
- package/System/Process.d.ts.map +1 -0
- package/System/Process.js +167 -0
- package/System/Process.js.map +1 -0
- package/System/Require.d.ts +8 -0
- package/System/Require.d.ts.map +1 -0
- package/System/Require.js +20 -0
- package/System/Require.js.map +1 -0
- package/System/Stopwatch.d.ts +19 -0
- package/System/Stopwatch.d.ts.map +1 -0
- package/System/Stopwatch.js +73 -0
- package/System/Stopwatch.js.map +1 -0
- package/System/String.d.ts +19 -0
- package/System/String.d.ts.map +1 -0
- package/System/String.js +177 -0
- package/System/String.js.map +1 -0
- package/System/Time.d.ts +7 -0
- package/System/Time.d.ts.map +1 -0
- package/System/Time.js +16 -0
- package/System/Time.js.map +1 -0
- package/System/Version.d.ts +20 -0
- package/System/Version.d.ts.map +1 -0
- package/System/Version.js +135 -0
- package/System/Version.js.map +1 -0
- package/Terminal/Terminal.d.ts +7 -0
- package/Terminal/Terminal.d.ts.map +1 -0
- package/Terminal/Terminal.js +21 -0
- package/Terminal/Terminal.js.map +1 -0
- package/Terminal/TerminalColorType.d.ts +2 -0
- package/Terminal/TerminalColorType.d.ts.map +1 -0
- package/Terminal/TerminalColorType.js +3 -0
- package/Terminal/TerminalColorType.js.map +1 -0
- package/Terminal/TerminalColors.d.ts +38 -0
- package/Terminal/TerminalColors.d.ts.map +1 -0
- package/Terminal/TerminalColors.js +151 -0
- package/Terminal/TerminalColors.js.map +1 -0
- package/Terminal/TerminalSymbolType.d.ts +2 -0
- package/Terminal/TerminalSymbolType.d.ts.map +1 -0
- package/Terminal/TerminalSymbolType.js +3 -0
- package/Terminal/TerminalSymbolType.js.map +1 -0
- package/Terminal/TerminalSymbols.d.ts +7 -0
- package/Terminal/TerminalSymbols.d.ts.map +1 -0
- package/Terminal/TerminalSymbols.js +30 -0
- package/Terminal/TerminalSymbols.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.TemporaryFile = void 0;
|
|
28
|
+
const fse = __importStar(require("fs-extra"));
|
|
29
|
+
const Path_1 = require("./Path");
|
|
30
|
+
const node_os_1 = require("node:os");
|
|
31
|
+
const node_path_1 = require("node:path");
|
|
32
|
+
// #endregion
|
|
33
|
+
/**
|
|
34
|
+
* The `TemporaryFile` class.
|
|
35
|
+
* A temporary file class. Delete when disposing.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
class TemporaryFile {
|
|
40
|
+
// #region Fields
|
|
41
|
+
_path;
|
|
42
|
+
// #endregion
|
|
43
|
+
// #region Ctor
|
|
44
|
+
/**
|
|
45
|
+
* Constructs a new instance of the `TemporaryFile` class.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
constructor() {
|
|
50
|
+
const tmpDir = (0, node_os_1.tmpdir)();
|
|
51
|
+
this._path = Path_1.Path.combine(fse.mkdtempSync(`${tmpDir}${node_path_1.sep}`), Path_1.Path.getRandomFileName(true));
|
|
52
|
+
}
|
|
53
|
+
// #endregion
|
|
54
|
+
// #region Properties
|
|
55
|
+
/**
|
|
56
|
+
* Gets the path to the temporary file.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
get path() {
|
|
61
|
+
return this._path;
|
|
62
|
+
}
|
|
63
|
+
// #endregion
|
|
64
|
+
// #region Methods
|
|
65
|
+
/**
|
|
66
|
+
* Disposes of the temporary file by deleting it if it exists.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
dispose() {
|
|
71
|
+
if (fse.existsSync(this._path)) {
|
|
72
|
+
fse.removeSync(this._path);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.TemporaryFile = TemporaryFile;
|
|
77
|
+
//# sourceMappingURL=TemporaryFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemporaryFile.js","sourceRoot":"","sources":["../../src/IO/TemporaryFile.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,8CAAgC;AAChC,iCAA8B;AAC9B,qCAAiC;AACjC,yCAAgC;AAEhC,aAAa;AAEb;;;;;GAKG;AACH,MAAa,aAAa;IAEtB,iBAAiB;IAEA,KAAK,CAAS;IAE/B,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH;QACI,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,WAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,eAAG,EAAE,CAAC,EAAE,WAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,aAAa;IAEb,qBAAqB;IAErB;;;;OAIG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;OAIG;IACI,OAAO;QACV,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;CAIJ;AAlDD,sCAkDC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as fs from 'fs';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for a file writer.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IFileWriter {
|
|
8
|
+
/**
|
|
9
|
+
* Writes text to the file without a newline character.
|
|
10
|
+
*
|
|
11
|
+
* @param message - The text to write.
|
|
12
|
+
*/
|
|
13
|
+
write(message: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Writes text to the file including a newline character.
|
|
16
|
+
*
|
|
17
|
+
* @param message - The text to write.
|
|
18
|
+
*/
|
|
19
|
+
writeLine(message: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Disposes the writer and releases internal resources.
|
|
22
|
+
*/
|
|
23
|
+
dispose(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Provides a writable stream for advanced use cases.
|
|
26
|
+
*
|
|
27
|
+
* @returns A writable stream or `null` if the writer is not available.
|
|
28
|
+
*/
|
|
29
|
+
getWritableStream(): fs.WriteStream | null;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=IFileWriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileWriter.d.ts","sourceRoot":"","sources":["../../../../src/IO/Writer/Interfaces/IFileWriter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,EAAE,MAAM,IAAI,CAAC;AAI9B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAExB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;;;OAIG;IACH,iBAAiB,IAAI,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;CAE9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileWriter.js","sourceRoot":"","sources":["../../../../src/IO/Writer/Interfaces/IFileWriter.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import type { IFileWriter } from './Interfaces/IFileWriter';
|
|
3
|
+
/**
|
|
4
|
+
* Provides clean access to a simple output text file.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class TextFileWriter implements IFileWriter {
|
|
9
|
+
private readonly _fileName;
|
|
10
|
+
private readonly _encoding;
|
|
11
|
+
private _writer;
|
|
12
|
+
private _isDisposed;
|
|
13
|
+
/**
|
|
14
|
+
* Initializes a new instance that will write to the specified file path/name.
|
|
15
|
+
*
|
|
16
|
+
* @param fileName - The file path/name to write to.
|
|
17
|
+
* @param encoding - The file encoding.
|
|
18
|
+
*/
|
|
19
|
+
constructor(fileName: string, encoding?: BufferEncoding);
|
|
20
|
+
/**
|
|
21
|
+
* Disposes the writer and releases internal resources.
|
|
22
|
+
*/
|
|
23
|
+
dispose(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Writes text to the file without a newline character.
|
|
26
|
+
*
|
|
27
|
+
* @param message - The text to write.
|
|
28
|
+
*/
|
|
29
|
+
write(message: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Writes text to the file including a newline character.
|
|
32
|
+
*
|
|
33
|
+
* @param message - The text to write.
|
|
34
|
+
*/
|
|
35
|
+
writeLine(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Provides a writable stream for advanced use cases.
|
|
38
|
+
*
|
|
39
|
+
* @returns A writable stream.
|
|
40
|
+
*/
|
|
41
|
+
getWritableStream(): fs.WriteStream | null;
|
|
42
|
+
/**
|
|
43
|
+
* Ensures that the writer is initialized and ready for writing.
|
|
44
|
+
*
|
|
45
|
+
* @returns `true` if the writer is ready; otherwise, `false`.
|
|
46
|
+
*/
|
|
47
|
+
private ensureWriter;
|
|
48
|
+
/**
|
|
49
|
+
* Provides a fallback mechanism for encoding with replacement fallbacks.
|
|
50
|
+
*
|
|
51
|
+
* @param encoding - The desired encoding.
|
|
52
|
+
* @returns The fallback-safe encoding.
|
|
53
|
+
*/
|
|
54
|
+
private getEncodingWithFallback;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=TextFileWriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFileWriter.d.ts","sourceRoot":"","sources":["../../../src/IO/Writer/TextFileWriter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,cAAe,YAAW,WAAW;IAI9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAkB;IAMrC;;;;;OAKG;gBACgB,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAwB;IASvE;;OAEG;IACI,OAAO,IAAI,IAAI;IAWtB;;;;OAIG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMnC;;;;OAIG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMvC;;;;OAIG;IACI,iBAAiB,IAAI,EAAE,CAAC,WAAW,GAAG,IAAI;IAIjD;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;CAQlC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TextFileWriter = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
/**
|
|
29
|
+
* Provides clean access to a simple output text file.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
class TextFileWriter {
|
|
34
|
+
// #region Fields
|
|
35
|
+
_fileName;
|
|
36
|
+
_encoding;
|
|
37
|
+
_writer = null;
|
|
38
|
+
_isDisposed = false;
|
|
39
|
+
// #endregion
|
|
40
|
+
// #region Ctor
|
|
41
|
+
/**
|
|
42
|
+
* Initializes a new instance that will write to the specified file path/name.
|
|
43
|
+
*
|
|
44
|
+
* @param fileName - The file path/name to write to.
|
|
45
|
+
* @param encoding - The file encoding.
|
|
46
|
+
*/
|
|
47
|
+
constructor(fileName, encoding = 'utf-8') {
|
|
48
|
+
this._fileName = fileName;
|
|
49
|
+
this._encoding = this.getEncodingWithFallback(encoding);
|
|
50
|
+
}
|
|
51
|
+
// #endregion
|
|
52
|
+
// #region Methods
|
|
53
|
+
/**
|
|
54
|
+
* Disposes the writer and releases internal resources.
|
|
55
|
+
*/
|
|
56
|
+
dispose() {
|
|
57
|
+
if (!this._isDisposed) {
|
|
58
|
+
if (this._writer) {
|
|
59
|
+
this._writer.end();
|
|
60
|
+
this._writer.close();
|
|
61
|
+
this._writer = null;
|
|
62
|
+
}
|
|
63
|
+
this._isDisposed = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Writes text to the file without a newline character.
|
|
68
|
+
*
|
|
69
|
+
* @param message - The text to write.
|
|
70
|
+
*/
|
|
71
|
+
write(message) {
|
|
72
|
+
if (this.ensureWriter()) {
|
|
73
|
+
this._writer?.write(message, this._encoding);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Writes text to the file including a newline character.
|
|
78
|
+
*
|
|
79
|
+
* @param message - The text to write.
|
|
80
|
+
*/
|
|
81
|
+
writeLine(message) {
|
|
82
|
+
if (this.ensureWriter()) {
|
|
83
|
+
this._writer?.write(`${message}\n`, this._encoding);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Provides a writable stream for advanced use cases.
|
|
88
|
+
*
|
|
89
|
+
* @returns A writable stream.
|
|
90
|
+
*/
|
|
91
|
+
getWritableStream() {
|
|
92
|
+
return this.ensureWriter() ? this._writer : null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Ensures that the writer is initialized and ready for writing.
|
|
96
|
+
*
|
|
97
|
+
* @returns `true` if the writer is ready; otherwise, `false`.
|
|
98
|
+
*/
|
|
99
|
+
ensureWriter() {
|
|
100
|
+
if (!this._writer) {
|
|
101
|
+
if (this._fileName) {
|
|
102
|
+
try {
|
|
103
|
+
this._writer = fs.createWriteStream(this._fileName, {
|
|
104
|
+
encoding: this._encoding,
|
|
105
|
+
flags: 'w',
|
|
106
|
+
highWaterMark: 4096
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
this._writer = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return this._writer !== null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Provides a fallback mechanism for encoding with replacement fallbacks.
|
|
118
|
+
*
|
|
119
|
+
* @param encoding - The desired encoding.
|
|
120
|
+
* @returns The fallback-safe encoding.
|
|
121
|
+
*/
|
|
122
|
+
getEncodingWithFallback(encoding) {
|
|
123
|
+
// Node.js does not provide direct equivalents for EncoderFallback or DecoderFallback.
|
|
124
|
+
// The fallback behavior is implicit in Node.js for unsupported sequences (e.g., replacing with `�`).
|
|
125
|
+
return encoding;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.TextFileWriter = TextFileWriter;
|
|
129
|
+
//# sourceMappingURL=TextFileWriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFileWriter.js","sourceRoot":"","sources":["../../../src/IO/Writer/TextFileWriter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAGzB;;;;GAIG;AACH,MAAa,cAAc;IAEvB,iBAAiB;IAEA,SAAS,CAAS;IAClB,SAAS,CAAiB;IACnC,OAAO,GAA0B,IAAI,CAAC;IACtC,WAAW,GAAY,KAAK,CAAC;IAErC,aAAa;IAEb,eAAe;IAEf;;;;;OAKG;IACH,YAAmB,QAAgB,EAAE,WAA2B,OAAO;QACnE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACf,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACnB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACxB,CAAC;YACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAe;QACxB,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,OAAe;QAC5B,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACK,YAAY;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,IAAI,CAAC;oBACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE;wBAChD,QAAQ,EAAE,IAAI,CAAC,SAAS;wBACxB,KAAK,EAAE,GAAG;wBACV,aAAa,EAAE,IAAI;qBACtB,CAAC,CAAC;gBACP,CAAC;gBAAC,MAAM,CAAC;oBACL,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACxB,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACK,uBAAuB,CAAC,QAAwB;QACpD,sFAAsF;QACtF,qGAAqG;QACrG,OAAO,QAAQ,CAAC;IACpB,CAAC;CAIJ;AA7GD,wCA6GC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IFileCache, IFileCacheOptions } from './Interfaces/IFileCache.js';
|
|
2
|
+
/**
|
|
3
|
+
* Implementation of the local file cache.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FileCache implements IFileCache {
|
|
6
|
+
private readonly _options;
|
|
7
|
+
/**
|
|
8
|
+
* Initializes a new instance of the FileCache class.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @param options - The options for the cache.
|
|
12
|
+
*/
|
|
13
|
+
constructor(options: IFileCacheOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a directory is cached.
|
|
16
|
+
* @param dirPath - The directory to check.
|
|
17
|
+
* @returns A promise resolving to `true` if the directory is cached, otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
isDirectoryCached(dirPath: string): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a file is cached.
|
|
22
|
+
* If not and caching is enabled, the file will be cached.
|
|
23
|
+
* @param file - The file to check.
|
|
24
|
+
* @returns A promise resolving to `true` if the file is cached, otherwise `false`.
|
|
25
|
+
*/
|
|
26
|
+
isFileCached(file: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the token of a file.
|
|
29
|
+
* The token is used to identify the file in the cache.
|
|
30
|
+
* @param file - The file for which to generate a token.
|
|
31
|
+
* @returns The token of the file.
|
|
32
|
+
*/
|
|
33
|
+
getFileToken(file: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Deletes a file from the cache.
|
|
36
|
+
* @param token - The token of the file to delete.
|
|
37
|
+
*/
|
|
38
|
+
deleteFile(token: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Writes data to the cache directory as a hashed file.
|
|
41
|
+
* @param data - The data to write.
|
|
42
|
+
* @returns `true` if the file already exists in the cache, otherwise `false`.
|
|
43
|
+
*/
|
|
44
|
+
private writeToFile;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=FileCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileCache.d.ts","sourceRoot":"","sources":["../../../src/IO/vNext/FileCache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAOhF;;GAEG;AACH,qBAAa,SAAU,YAAW,UAAU;IAIxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAM7C;;;;;OAKG;gBACgB,OAAO,EAAE,iBAAiB;IAY7C;;;;OAIG;IACU,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWjE;;;;;OAKG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASzD;;;;;OAKG;IACI,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKzC;;;OAGG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOtC;;;;OAIG;IACH,OAAO,CAAC,WAAW;CAYtB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FileCache = void 0;
|
|
5
|
+
const File_js_1 = require("../File.js");
|
|
6
|
+
const Path_js_1 = require("../Path.js");
|
|
7
|
+
const String_js_1 = require("../../System/String.js");
|
|
8
|
+
// #endregion
|
|
9
|
+
/**
|
|
10
|
+
* Implementation of the local file cache.
|
|
11
|
+
*/
|
|
12
|
+
class FileCache {
|
|
13
|
+
// #region Fields
|
|
14
|
+
_options;
|
|
15
|
+
// #endregion
|
|
16
|
+
// #region Ctor
|
|
17
|
+
/**
|
|
18
|
+
* Initializes a new instance of the FileCache class.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @param options - The options for the cache.
|
|
22
|
+
*/
|
|
23
|
+
constructor(options) {
|
|
24
|
+
if (!options.dirPath) {
|
|
25
|
+
throw new Error('The cache directory must be specified.');
|
|
26
|
+
}
|
|
27
|
+
this._options = options;
|
|
28
|
+
}
|
|
29
|
+
// #endregion
|
|
30
|
+
// #region Methods
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a directory is cached.
|
|
33
|
+
* @param dirPath - The directory to check.
|
|
34
|
+
* @returns A promise resolving to `true` if the directory is cached, otherwise `false`.
|
|
35
|
+
*/
|
|
36
|
+
async isDirectoryCached(dirPath) {
|
|
37
|
+
if (!this._options.enabled) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const files = File_js_1.File.glob(dirPath);
|
|
41
|
+
const fileContents = await Promise.all(files.map((x) => File_js_1.File.readAllBytes(x)));
|
|
42
|
+
const aggregatedData = Buffer.concat(fileContents);
|
|
43
|
+
return this.writeToFile(aggregatedData.toString());
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a file is cached.
|
|
47
|
+
* If not and caching is enabled, the file will be cached.
|
|
48
|
+
* @param file - The file to check.
|
|
49
|
+
* @returns A promise resolving to `true` if the file is cached, otherwise `false`.
|
|
50
|
+
*/
|
|
51
|
+
async isFileCached(file) {
|
|
52
|
+
if (!this._options.enabled) {
|
|
53
|
+
return Promise.resolve(false);
|
|
54
|
+
}
|
|
55
|
+
const fileContent = File_js_1.File.readAllText(file);
|
|
56
|
+
return Promise.resolve(this.writeToFile(fileContent));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the token of a file.
|
|
60
|
+
* The token is used to identify the file in the cache.
|
|
61
|
+
* @param file - The file for which to generate a token.
|
|
62
|
+
* @returns The token of the file.
|
|
63
|
+
*/
|
|
64
|
+
getFileToken(file) {
|
|
65
|
+
const data = File_js_1.File.readAllText(file);
|
|
66
|
+
return String_js_1.StringExtensions.md5(data);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Deletes a file from the cache.
|
|
70
|
+
* @param token - The token of the file to delete.
|
|
71
|
+
*/
|
|
72
|
+
deleteFile(token) {
|
|
73
|
+
const cacheFile = Path_js_1.Path.combine(this._options.dirPath, token);
|
|
74
|
+
if (File_js_1.File.exists(cacheFile)) {
|
|
75
|
+
File_js_1.File.delete(cacheFile);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Writes data to the cache directory as a hashed file.
|
|
80
|
+
* @param data - The data to write.
|
|
81
|
+
* @returns `true` if the file already exists in the cache, otherwise `false`.
|
|
82
|
+
*/
|
|
83
|
+
writeToFile(data) {
|
|
84
|
+
const hash = String_js_1.StringExtensions.md5(data);
|
|
85
|
+
const cacheFile = Path_js_1.Path.combine(this._options.dirPath, hash);
|
|
86
|
+
if (File_js_1.File.exists(cacheFile)) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
File_js_1.File.writeAllText(cacheFile, '');
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.FileCache = FileCache;
|
|
94
|
+
//# sourceMappingURL=FileCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileCache.js","sourceRoot":"","sources":["../../../src/IO/vNext/FileCache.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,wCAAkC;AAClC,wCAAkC;AAClC,sDAA0D;AAE1D,aAAa;AAEb;;GAEG;AACH,MAAa,SAAS;IAElB,iBAAiB;IAEA,QAAQ,CAAoB;IAE7C,aAAa;IAEb,eAAe;IAEf;;;;;OAKG;IACH,YAAmB,OAA0B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;OAIG;IACI,KAAK,CAAC,iBAAiB,CAAC,OAAe;QAC1C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,MAAM,KAAK,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CAAC,IAAY;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,MAAM,WAAW,GAAG,cAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAY;QAC5B,MAAM,IAAI,GAAG,cAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,4BAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,KAAa;QAC3B,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7D,IAAI,cAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACzB,cAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,IAAY;QAC5B,MAAM,IAAI,GAAG,4BAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,cAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,cAAI,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC;IACjB,CAAC;CAIJ;AAlGD,8BAkGC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { JSONObject } from '../Json.js';
|
|
2
|
+
import type { IResxEntry } from '../Resx.js';
|
|
3
|
+
import type { IFileSystem } from './Interfaces/IFileSystem.js';
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the IFileSystem interface.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class FileSystem implements IFileSystem {
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a new instance of the `FileSystem` class.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Finds files matching a glob pattern.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
* @param pattern - The glob pattern to search for.
|
|
21
|
+
* @returns An array of file paths matching the pattern.
|
|
22
|
+
*/
|
|
23
|
+
glob(pattern: string | Array<string>): Array<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Reads all text from a file.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @param filePath - The path to the file.
|
|
29
|
+
* @returns The content of the file as a string.
|
|
30
|
+
*/
|
|
31
|
+
readAllText(filePath: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Writes text to a file, creating directories if necessary.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
* @param filePath - The path to the file.
|
|
37
|
+
* @param content - The content to write to the file.
|
|
38
|
+
*/
|
|
39
|
+
writeAllText(filePath: string, content: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Reads all entries from a .resx file.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
* @param filePath - The path to the .resx file.
|
|
45
|
+
* @returns An array of key-value-comment objects from the .resx file.
|
|
46
|
+
*/
|
|
47
|
+
readAllResx(filePath: string): Array<IResxEntry>;
|
|
48
|
+
/**
|
|
49
|
+
* Reads all JSON from a file.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
* @param filePath - The path to the file.
|
|
53
|
+
* @returns The JSON content of the file.
|
|
54
|
+
*/
|
|
55
|
+
readAllJson(filePath: string): JSONObject;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the file name without its extension.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
* @param filePath - The path to the file.
|
|
61
|
+
* @returns The file name without extension.
|
|
62
|
+
*/
|
|
63
|
+
getFileNameWithoutExtension(filePath: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the file name from a file path.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
* @param filePath - The path to the file.
|
|
69
|
+
* @returns The file name.
|
|
70
|
+
*/
|
|
71
|
+
getFileName(filePath: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Extracts the locale from a file name.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @param filePath - The path to the file.
|
|
77
|
+
* @param defaultLocale - The default locale to return if no locale is found.
|
|
78
|
+
* @returns The locale extracted from the file name.
|
|
79
|
+
*/
|
|
80
|
+
getLocale(filePath: string, defaultLocale?: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if a file exists.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
* @param filePath - The path to the file.
|
|
86
|
+
* @returns `true` if the file exists, or `false` otherwise
|
|
87
|
+
*/
|
|
88
|
+
exists(filePath: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if a file is cached.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
* @param filePath - The path to the file.
|
|
94
|
+
* @returns A promise resolving to whether the file is cached.
|
|
95
|
+
*/
|
|
96
|
+
isFileOrDirectory(inputPath: string): 'file' | 'directory' | 'unknown';
|
|
97
|
+
/**
|
|
98
|
+
* Changes the extension of a file path.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
* @param filePath - The file path to change.
|
|
102
|
+
* @param extension - The new extension to use.
|
|
103
|
+
* @returns The file path with the new extension.
|
|
104
|
+
*/
|
|
105
|
+
changeExtension(filePath: string, extension: string): string;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=FileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/IO/vNext/FileSystem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI/D;;;;GAIG;AACH,qBAAa,UAAW,YAAW,WAAW;IAI1C;;;;OAIG;;IAQH;;;;;;OAMG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAI3D;;;;;;OAMG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5C;;;;;;OAMG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5D;;;;;;OAMG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC;IAIvD;;;;;;OAMG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAIhD;;;;;;OAMG;IACI,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5D;;;;;;OAMG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5C;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,GAAE,MAAa,GAAG,MAAM;IAIxE;;;;;;OAMG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS;IAgB7E;;;;;;;OAOG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;CAMtE"}
|