@theia/filesystem 1.65.0-next.55 → 1.65.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/lib/browser/download/file-download-command-contribution.d.ts +1 -1
- package/lib/browser/download/file-download-command-contribution.d.ts.map +1 -1
- package/lib/browser/download/file-download-command-contribution.js +3 -3
- package/lib/browser/download/file-download-command-contribution.js.map +1 -1
- package/lib/browser/download/file-download-frontend-module.d.ts.map +1 -1
- package/lib/browser/download/file-download-frontend-module.js +2 -1
- package/lib/browser/download/file-download-frontend-module.js.map +1 -1
- package/lib/browser/download/file-download-service.d.ts +2 -10
- package/lib/browser/download/file-download-service.d.ts.map +1 -1
- package/lib/browser/download/file-download-service.js +8 -7
- package/lib/browser/download/file-download-service.js.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.d.ts +1 -1
- package/lib/browser/file-tree/file-tree-widget.d.ts.map +1 -1
- package/lib/browser/file-tree/file-tree-widget.js +3 -3
- package/lib/browser/file-tree/file-tree-widget.js.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.d.ts +2 -2
- package/lib/browser/filesystem-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/filesystem-frontend-contribution.js +3 -3
- package/lib/browser/filesystem-frontend-contribution.js.map +1 -1
- package/lib/browser/filesystem-frontend-module.d.ts.map +1 -1
- package/lib/browser/filesystem-frontend-module.js +3 -2
- package/lib/browser/filesystem-frontend-module.js.map +1 -1
- package/lib/browser/{file-upload-service.d.ts → upload/file-upload-service-impl.d.ts} +16 -52
- package/lib/browser/upload/file-upload-service-impl.d.ts.map +1 -0
- package/lib/browser/{file-upload-service.js → upload/file-upload-service-impl.js} +27 -27
- package/lib/browser/upload/file-upload-service-impl.js.map +1 -0
- package/lib/browser-only/browser-only-filesystem-frontend-module.d.ts.map +1 -1
- package/lib/browser-only/browser-only-filesystem-frontend-module.js +8 -0
- package/lib/browser-only/browser-only-filesystem-frontend-module.js.map +1 -1
- package/lib/browser-only/download/file-download-command-contribution.d.ts +15 -0
- package/lib/browser-only/download/file-download-command-contribution.d.ts.map +1 -0
- package/lib/browser-only/download/file-download-command-contribution.js +55 -0
- package/lib/browser-only/download/file-download-command-contribution.js.map +1 -0
- package/lib/browser-only/download/file-download-frontend-module.d.ts +4 -0
- package/lib/browser-only/download/file-download-frontend-module.d.ts.map +1 -0
- package/lib/browser-only/download/file-download-frontend-module.js +27 -0
- package/lib/browser-only/download/file-download-frontend-module.js.map +1 -0
- package/lib/browser-only/download/file-download-service.d.ts +86 -0
- package/lib/browser-only/download/file-download-service.d.ts.map +1 -0
- package/lib/browser-only/download/file-download-service.js +551 -0
- package/lib/browser-only/download/file-download-service.js.map +1 -0
- package/lib/browser-only/file-search.d.ts +38 -0
- package/lib/browser-only/file-search.d.ts.map +1 -0
- package/lib/browser-only/file-search.js +153 -0
- package/lib/browser-only/file-search.js.map +1 -0
- package/lib/browser-only/opfs-filesystem-initialization.d.ts +4 -2
- package/lib/browser-only/opfs-filesystem-initialization.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-initialization.js +4 -1
- package/lib/browser-only/opfs-filesystem-initialization.js.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.d.ts +89 -12
- package/lib/browser-only/opfs-filesystem-provider.d.ts.map +1 -1
- package/lib/browser-only/opfs-filesystem-provider.js +345 -181
- package/lib/browser-only/opfs-filesystem-provider.js.map +1 -1
- package/lib/browser-only/upload/file-upload-service-impl.d.ts +67 -0
- package/lib/browser-only/upload/file-upload-service-impl.d.ts.map +1 -0
- package/lib/browser-only/upload/file-upload-service-impl.js +328 -0
- package/lib/browser-only/upload/file-upload-service-impl.js.map +1 -0
- package/lib/common/download/file-download.d.ts +17 -0
- package/lib/common/download/file-download.d.ts.map +1 -0
- package/lib/common/download/{file-download-data.js → file-download.js} +3 -2
- package/lib/common/download/file-download.js.map +1 -0
- package/lib/common/files.d.ts +8 -1
- package/lib/common/files.d.ts.map +1 -1
- package/lib/common/files.js +35 -1
- package/lib/common/files.js.map +1 -1
- package/lib/common/io.js +7 -1
- package/lib/common/io.js.map +1 -1
- package/lib/common/upload/file-upload.d.ts +45 -0
- package/lib/common/upload/file-upload.d.ts.map +1 -0
- package/{src/common/download/file-download-data.ts → lib/common/upload/file-upload.js} +6 -13
- package/lib/common/upload/file-upload.js.map +1 -0
- package/lib/node/disk-file-system-provider.d.ts.map +1 -1
- package/lib/node/disk-file-system-provider.js +2 -4
- package/lib/node/disk-file-system-provider.js.map +1 -1
- package/lib/node/download/file-download-handler.js +2 -2
- package/lib/node/download/file-download-handler.js.map +1 -1
- package/lib/node/filesystem-backend-module.js +1 -1
- package/lib/node/filesystem-backend-module.js.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts +2 -2
- package/lib/node/parcel-watcher/parcel-filesystem-service.d.ts.map +1 -1
- package/lib/node/parcel-watcher/parcel-filesystem-service.js.map +1 -1
- package/lib/node/upload/node-file-upload-service.d.ts.map +1 -0
- package/lib/node/{node-file-upload-service.js → upload/node-file-upload-service.js} +1 -1
- package/lib/node/upload/node-file-upload-service.js.map +1 -0
- package/package.json +10 -5
- package/src/browser/download/file-download-command-contribution.ts +1 -1
- package/src/browser/download/file-download-frontend-module.ts +3 -2
- package/src/browser/download/file-download-service.ts +7 -12
- package/src/browser/file-tree/file-tree-widget.tsx +1 -1
- package/src/browser/filesystem-frontend-contribution.ts +2 -2
- package/src/browser/filesystem-frontend-module.ts +3 -2
- package/src/browser/{file-upload-service.ts → upload/file-upload-service-impl.ts} +31 -72
- package/src/browser-only/browser-only-filesystem-frontend-module.ts +10 -0
- package/src/browser-only/download/file-download-command-contribution.ts +56 -0
- package/src/browser-only/download/file-download-frontend-module.ts +26 -0
- package/src/browser-only/download/file-download-service.ts +726 -0
- package/src/browser-only/file-search.ts +170 -0
- package/src/browser-only/opfs-filesystem-initialization.ts +7 -4
- package/src/browser-only/opfs-filesystem-provider.ts +402 -189
- package/src/browser-only/upload/file-upload-service-impl.ts +408 -0
- package/src/common/download/file-download.ts +40 -0
- package/src/common/files.ts +42 -1
- package/src/common/io.ts +6 -1
- package/src/common/upload/file-upload.ts +65 -0
- package/src/node/disk-file-system-provider.ts +3 -4
- package/src/node/download/file-download-handler.ts +1 -1
- package/src/node/filesystem-backend-module.ts +1 -1
- package/src/node/parcel-watcher/parcel-filesystem-service.ts +2 -2
- package/src/node/{node-file-upload-service.ts → upload/node-file-upload-service.ts} +1 -1
- package/lib/browser/file-upload-service.d.ts.map +0 -1
- package/lib/browser/file-upload-service.js.map +0 -1
- package/lib/common/download/file-download-data.d.ts +0 -7
- package/lib/common/download/file-download-data.d.ts.map +0 -1
- package/lib/common/download/file-download-data.js.map +0 -1
- package/lib/node/node-file-upload-service.d.ts.map +0 -1
- package/lib/node/node-file-upload-service.js.map +0 -1
- /package/lib/node/{node-file-upload-service.d.ts → upload/node-file-upload-service.d.ts} +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 Maksim Kachurin and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.getIgnorePatterns = exports.createIgnoreMatcher = exports.matchesPattern = exports.normalizeGlob = void 0;
|
|
19
|
+
const minimatch_1 = require("minimatch");
|
|
20
|
+
const ignore_1 = require("ignore");
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes glob patterns to be consistent with ripgrep behavior.
|
|
23
|
+
*
|
|
24
|
+
* Examples of transformations:
|
|
25
|
+
* - "*.js" -> "**\/*.js" (make non-root patterns match anywhere)
|
|
26
|
+
* - "src/" -> "src\/**" (directory patterns match all contents)
|
|
27
|
+
* - "!*.log" -> "!**\/*.log" (negation patterns)
|
|
28
|
+
* - "src/**\/**\/file.js" -> "src/**\/file.js" (collapse repeated double-star patterns)
|
|
29
|
+
*
|
|
30
|
+
* @param glob - The glob pattern to normalize
|
|
31
|
+
* @returns The normalized glob pattern
|
|
32
|
+
*/
|
|
33
|
+
function normalizeGlob(glob) {
|
|
34
|
+
let neg = '';
|
|
35
|
+
let root = false;
|
|
36
|
+
// Handle negation patterns (starting with '!')
|
|
37
|
+
if (glob.startsWith('!')) {
|
|
38
|
+
neg = '!';
|
|
39
|
+
glob = glob.slice(1);
|
|
40
|
+
}
|
|
41
|
+
// Convert Windows backslashes to forward slashes for consistency
|
|
42
|
+
glob = glob.replace(/\\/g, '/');
|
|
43
|
+
// Remove redundant './' prefix (same as current directory)
|
|
44
|
+
if (glob.startsWith('./')) {
|
|
45
|
+
glob = glob.slice(1);
|
|
46
|
+
}
|
|
47
|
+
// Check if pattern is root-anchored (starts with '/')
|
|
48
|
+
if (glob.startsWith('/')) {
|
|
49
|
+
root = true;
|
|
50
|
+
}
|
|
51
|
+
// Convert directory patterns to match all contents
|
|
52
|
+
// "src/" becomes "src/**" to match everything inside the directory
|
|
53
|
+
if (glob.endsWith('/') && !glob.endsWith('/**')) {
|
|
54
|
+
glob = glob + '**';
|
|
55
|
+
}
|
|
56
|
+
// Make non-root patterns match anywhere in the directory tree
|
|
57
|
+
// "*.js" becomes "**/*.js" to match .js files anywhere
|
|
58
|
+
if (!root && !glob.startsWith('**')) {
|
|
59
|
+
glob = '**/' + glob;
|
|
60
|
+
}
|
|
61
|
+
// Clean up repeated '**/' patterns
|
|
62
|
+
// "src/**/**/file.js" becomes "src/**/file.js"
|
|
63
|
+
glob = glob.replace(/(\*\*\/)+\*\*\//g, '**/');
|
|
64
|
+
// Restore negation prefix if it was present
|
|
65
|
+
return neg + glob;
|
|
66
|
+
}
|
|
67
|
+
exports.normalizeGlob = normalizeGlob;
|
|
68
|
+
/**
|
|
69
|
+
* Checks if a text matches any of the minimatch patterns
|
|
70
|
+
* @param text - The text to check
|
|
71
|
+
* @param patterns - The patterns to check
|
|
72
|
+
* @returns True if the text matches any of the patterns, false otherwise
|
|
73
|
+
*/
|
|
74
|
+
function matchesPattern(text, patterns, opts) {
|
|
75
|
+
return patterns.some(pattern => (0, minimatch_1.minimatch)(text, pattern, opts));
|
|
76
|
+
}
|
|
77
|
+
exports.matchesPattern = matchesPattern;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new ignore pattern matcher for managing ignore patterns.
|
|
80
|
+
* @returns An object with add and ignores methods
|
|
81
|
+
*/
|
|
82
|
+
function createIgnoreMatcher() {
|
|
83
|
+
const ig = (0, ignore_1.default)();
|
|
84
|
+
return {
|
|
85
|
+
add: (patterns) => ig.add(patterns),
|
|
86
|
+
ignores: (path) => ig.ignores(path)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
exports.createIgnoreMatcher = createIgnoreMatcher;
|
|
90
|
+
/**
|
|
91
|
+
* Processes ignore files (.gitignore, .ignore, .rgignore) in a directory.
|
|
92
|
+
* @param dir - The directory URI to process
|
|
93
|
+
* @param read - Function to read the ignore file content
|
|
94
|
+
* @returns Array of processed ignore patterns relative to the directory contains that ignore file
|
|
95
|
+
*/
|
|
96
|
+
async function getIgnorePatterns(dir, read) {
|
|
97
|
+
const fromPath = dir.path.toString();
|
|
98
|
+
const ignoreFiles = await Promise.allSettled(['.gitignore', '.ignore', '.rgignore'].map(file => read(dir.resolve(file))));
|
|
99
|
+
const lines = ignoreFiles
|
|
100
|
+
.filter(result => result.status === 'fulfilled')
|
|
101
|
+
.flatMap((result) => result.value
|
|
102
|
+
.split('\n')
|
|
103
|
+
.map(line => prefixGitignoreLine(fromPath, line))
|
|
104
|
+
.filter((line) => typeof line === 'string'));
|
|
105
|
+
return lines;
|
|
106
|
+
}
|
|
107
|
+
exports.getIgnorePatterns = getIgnorePatterns;
|
|
108
|
+
/**
|
|
109
|
+
* Convert patterns from dir base to root-relative git semantics.
|
|
110
|
+
* @param baseRel - The base relative path
|
|
111
|
+
* @param raw - The raw pattern
|
|
112
|
+
* @returns The processed pattern
|
|
113
|
+
*/
|
|
114
|
+
function prefixGitignoreLine(baseRel, raw) {
|
|
115
|
+
let line = raw.replace(/\r?\n$/, '');
|
|
116
|
+
if (!line || /^\s*#/.test(line)) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
// handle escaped leading '!' and '#'
|
|
120
|
+
const escapedBang = line.startsWith('\\!');
|
|
121
|
+
const escapedHash = line.startsWith('\\#');
|
|
122
|
+
if (escapedBang || escapedHash) {
|
|
123
|
+
line = line.slice(1);
|
|
124
|
+
}
|
|
125
|
+
const neg = !escapedBang && line.startsWith('!');
|
|
126
|
+
if (neg) {
|
|
127
|
+
line = line.slice(1);
|
|
128
|
+
}
|
|
129
|
+
// normalize slashes in the pattern part
|
|
130
|
+
line = line.replace(/\\/g, '/');
|
|
131
|
+
// strip leading "./"
|
|
132
|
+
if (line.startsWith('./')) {
|
|
133
|
+
line = line.slice(2);
|
|
134
|
+
}
|
|
135
|
+
const anchored = line.startsWith('/');
|
|
136
|
+
const hasSlash = line.includes('/');
|
|
137
|
+
const prefix = baseRel ? baseRel.replace(/\\/g, '/').replace(/^\/+/, '').replace(/\/+$/, '') : '';
|
|
138
|
+
let pattern;
|
|
139
|
+
if (anchored) {
|
|
140
|
+
// "/foo" in base -> "base/foo"
|
|
141
|
+
pattern = (prefix ? `${prefix}${line}` : line.slice(1)); // remove leading '/' if no base
|
|
142
|
+
}
|
|
143
|
+
else if (hasSlash) {
|
|
144
|
+
// "bar/*.js" in base -> "base/bar/*.js"
|
|
145
|
+
pattern = prefix ? `${prefix}/${line}` : line;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// "foo" in base -> "base/**/foo"
|
|
149
|
+
pattern = prefix ? `${prefix}/**/${line}` : line;
|
|
150
|
+
}
|
|
151
|
+
return neg ? `!${pattern}` : pattern;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=file-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-search.js","sourceRoot":"","sources":["../../src/browser-only/file-search.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,iDAAiD;AACjD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,yCAA6D;AAC7D,mCAA4B;AAI5B;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,IAAY;IACtC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,+CAA+C;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,CAAC;QACV,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,iEAAiE;IACjE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEhC,2DAA2D;IAC3D,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,sDAAsD;IACtD,IAAI,IAAI,CAAC,UAAU,CAAC,GAA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,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { OPFSFileSystemProvider } from './opfs-filesystem-provider';
|
|
2
2
|
export declare const OPFSInitialization: unique symbol;
|
|
3
3
|
export interface OPFSInitialization {
|
|
4
|
-
|
|
4
|
+
getBroadcastChannel(): BroadcastChannel;
|
|
5
|
+
getRootDirectory(): Promise<string> | string;
|
|
5
6
|
initializeFS(provider: OPFSFileSystemProvider): Promise<void>;
|
|
6
7
|
}
|
|
7
8
|
export declare class DefaultOPFSInitialization implements OPFSInitialization {
|
|
8
|
-
|
|
9
|
+
getBroadcastChannel(): BroadcastChannel;
|
|
10
|
+
getRootDirectory(): Promise<string> | string;
|
|
9
11
|
initializeFS(provider: OPFSFileSystemProvider): Promise<void>;
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=opfs-filesystem-initialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opfs-filesystem-initialization.d.ts","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-initialization.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,WAAW,kBAAkB;IAC/B,gBAAgB,IAAI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"opfs-filesystem-initialization.d.ts","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-initialization.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,WAAW,kBAAkB;IAC/B,mBAAmB,IAAI,gBAAgB,CAAC;IACxC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC7C,YAAY,CAAC,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,qBACa,yBAA0B,YAAW,kBAAkB;IAChE,mBAAmB,IAAI,gBAAgB;IAIvC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;IAItC,YAAY,CAAC,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAEtE"}
|
|
@@ -20,8 +20,11 @@ const tslib_1 = require("tslib");
|
|
|
20
20
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
21
|
exports.OPFSInitialization = Symbol('OPFSInitialization');
|
|
22
22
|
let DefaultOPFSInitialization = class DefaultOPFSInitialization {
|
|
23
|
+
getBroadcastChannel() {
|
|
24
|
+
return new BroadcastChannel('theia-opfs-events');
|
|
25
|
+
}
|
|
23
26
|
getRootDirectory() {
|
|
24
|
-
return
|
|
27
|
+
return '/';
|
|
25
28
|
}
|
|
26
29
|
async initializeFS(provider) {
|
|
27
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opfs-filesystem-initialization.js","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-initialization.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAGhF,4DAA0D;AAE7C,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"opfs-filesystem-initialization.js","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-initialization.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAGhF,4DAA0D;AAE7C,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAQxD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAClC,mBAAmB;QACf,OAAO,IAAI,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAED,gBAAgB;QACZ,OAAO,GAAG,CAAC;IACf,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgC;IACnD,CAAC;CACJ,CAAA;AAXY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAWrC"}
|
|
@@ -1,31 +1,108 @@
|
|
|
1
|
-
import { FileChange, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileSystemProviderWithFileReadWriteCapability, FileType, FileWriteOptions, Stat, WatchOptions } from '../common/files';
|
|
2
|
-
import { Event, URI, Disposable } from '@theia/core';
|
|
1
|
+
import { FileChange, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileSystemProviderWithFileReadWriteCapability, FileSystemProviderWithFileFolderCopyCapability, FileSystemProviderWithOpenReadWriteCloseCapability, FileType, FileWriteOptions, Stat, WatchOptions, FileOpenOptions, FileUpdateOptions, FileUpdateResult, type FileReadStreamOptions } from '../common/files';
|
|
2
|
+
import { Event, URI, Disposable, DisposableCollection, type CancellationToken } from '@theia/core';
|
|
3
|
+
import { EncodingService } from '@theia/core/lib/common/encoding-service';
|
|
4
|
+
import { TextDocumentContentChangeEvent } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
3
5
|
import { OPFSInitialization } from './opfs-filesystem-initialization';
|
|
4
|
-
|
|
6
|
+
import { ReadableStreamEvents } from '@theia/core/lib/common/stream';
|
|
7
|
+
export declare class OPFSFileSystemProvider implements Disposable, FileSystemProviderWithFileReadWriteCapability, FileSystemProviderWithOpenReadWriteCloseCapability, FileSystemProviderWithFileFolderCopyCapability {
|
|
8
|
+
private readonly BUFFER_SIZE;
|
|
5
9
|
capabilities: FileSystemProviderCapabilities;
|
|
6
10
|
onDidChangeCapabilities: Event<void>;
|
|
7
11
|
private readonly onDidChangeFileEmitter;
|
|
8
12
|
readonly onDidChangeFile: Event<readonly FileChange[]>;
|
|
9
|
-
onFileWatchError: Event<void>;
|
|
13
|
+
readonly onFileWatchError: Event<void>;
|
|
10
14
|
protected readonly initialization: OPFSInitialization;
|
|
11
|
-
|
|
15
|
+
protected readonly encodingService: EncodingService;
|
|
16
|
+
private fs;
|
|
12
17
|
private initialized;
|
|
18
|
+
protected readonly toDispose: DisposableCollection;
|
|
19
|
+
/**
|
|
20
|
+
* Initializes the OPFS file system provider
|
|
21
|
+
*/
|
|
13
22
|
protected init(): void;
|
|
14
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Watches a resource for file system changes
|
|
25
|
+
*/
|
|
26
|
+
watch(resource: URI, opts: WatchOptions): Disposable;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an index from the map of entries
|
|
29
|
+
*/
|
|
30
|
+
createIndex(entries: Map<URI, Uint8Array>): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the current file system index
|
|
33
|
+
*/
|
|
34
|
+
index(): Promise<Map<URI, Stat>>;
|
|
35
|
+
/**
|
|
36
|
+
* Clears the file system
|
|
37
|
+
*/
|
|
38
|
+
clear(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a resource exists
|
|
41
|
+
*/
|
|
15
42
|
exists(resource: URI): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets file system statistics for a resource
|
|
45
|
+
*/
|
|
16
46
|
stat(resource: URI): Promise<Stat>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a directory
|
|
49
|
+
*/
|
|
17
50
|
mkdir(resource: URI): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Reads directory contents
|
|
53
|
+
*/
|
|
18
54
|
readdir(resource: URI): Promise<[string, FileType][]>;
|
|
19
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Deletes a resource
|
|
57
|
+
*/
|
|
58
|
+
delete(resource: URI, opts: FileDeleteOptions): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Renames a resource from one location to another
|
|
61
|
+
*/
|
|
20
62
|
rename(from: URI, to: URI, opts: FileOverwriteOptions): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Copies a resource from one location to another
|
|
65
|
+
*/
|
|
66
|
+
copy(from: URI, to: URI, opts: FileOverwriteOptions): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Reads file content as binary data
|
|
69
|
+
*/
|
|
21
70
|
readFile(resource: URI): Promise<Uint8Array>;
|
|
71
|
+
/**
|
|
72
|
+
* Reads file content as a stream
|
|
73
|
+
*/
|
|
74
|
+
readFileStream(resource: URI, opts: FileReadStreamOptions, token: CancellationToken): ReadableStreamEvents<Uint8Array>;
|
|
75
|
+
/**
|
|
76
|
+
* Writes binary content to a file
|
|
77
|
+
*/
|
|
22
78
|
writeFile(resource: URI, content: Uint8Array, opts: FileWriteOptions): Promise<void>;
|
|
23
79
|
/**
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
80
|
+
* Opens a file and returns a file descriptor
|
|
81
|
+
*/
|
|
82
|
+
open(resource: URI, opts: FileOpenOptions): Promise<number>;
|
|
83
|
+
/**
|
|
84
|
+
* Closes a file descriptor
|
|
85
|
+
*/
|
|
86
|
+
close(fd: number): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Reads data from a file descriptor
|
|
89
|
+
*/
|
|
90
|
+
read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;
|
|
91
|
+
/**
|
|
92
|
+
* Writes data to a file descriptor
|
|
93
|
+
*/
|
|
94
|
+
write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): Promise<number>;
|
|
95
|
+
/**
|
|
96
|
+
* Updates a text file with content changes
|
|
97
|
+
*/
|
|
98
|
+
updateFile(resource: URI, changes: TextDocumentContentChangeEvent[], opts: FileUpdateOptions): Promise<FileUpdateResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Handles file system change events from BroadcastChannel
|
|
101
|
+
*/
|
|
102
|
+
private handleFileSystemChange;
|
|
103
|
+
/**
|
|
104
|
+
* Disposes the file system provider
|
|
28
105
|
*/
|
|
29
|
-
|
|
106
|
+
dispose(): void;
|
|
30
107
|
}
|
|
31
108
|
//# sourceMappingURL=opfs-filesystem-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opfs-filesystem-provider.d.ts","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-provider.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,UAAU,EAAkB,iBAAiB,EAC7C,oBAAoB,EAAE,8BAA8B,EAGpD,6CAA6C,EAC7C,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"opfs-filesystem-provider.d.ts","sourceRoot":"","sources":["../../src/browser-only/opfs-filesystem-provider.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,UAAU,EAAkB,iBAAiB,EAC7C,oBAAoB,EAAE,8BAA8B,EAGpD,6CAA6C,EAC7C,8CAA8C,EAC9C,kDAAkD,EAClD,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAC9C,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EACpD,KAAK,qBAAqB,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAW,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,iBAAiB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