@lvce-editor/extension-host-worker 3.12.0 → 3.13.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.
@@ -3075,6 +3075,15 @@ const setup = ({
3075
3075
  global.vscode = api;
3076
3076
  };
3077
3077
 
3078
+ const applyBulkReplacement = async (files, ranges, replacement) => {
3079
+ console.log({
3080
+ files,
3081
+ ranges,
3082
+ replacement
3083
+ });
3084
+ throw new Error('not implemented');
3085
+ };
3086
+
3078
3087
  const getAssetDir = () => {
3079
3088
  // @ts-ignore
3080
3089
  if (typeof ASSET_DIR !== 'undefined') {
@@ -3827,9 +3836,9 @@ const getBlob$1 = async (uri, type) => {
3827
3836
  };
3828
3837
 
3829
3838
  class FileNotFoundError extends Error {
3830
- constructor(message) {
3831
- super(message);
3832
- this.name = 'FileNotFoundError';
3839
+ constructor(uri) {
3840
+ super(`File not found: ${uri}`);
3841
+ this.code = 'ENOENT';
3833
3842
  }
3834
3843
  }
3835
3844
 
@@ -3928,6 +3937,8 @@ const ensureParentDir = uri => {
3928
3937
  const writeFile = (uri, content) => {
3929
3938
  const dirent = getDirent(uri);
3930
3939
  if (dirent) {
3940
+ // TODO create new dirent
3941
+ // @ts-ignore
3931
3942
  dirent.content = content;
3932
3943
  } else {
3933
3944
  ensureParentDir(uri);
@@ -4704,7 +4715,7 @@ const textSearch$1 = async (scheme, root, query) => {
4704
4715
  const relativeRoot = root.slice('html://'.length);
4705
4716
  const handle = await getDirectoryHandle(relativeRoot);
4706
4717
  if (!handle) {
4707
- throw new FileNotFoundError(`Folder not found: ${relativeRoot}`);
4718
+ throw new FileNotFoundError(relativeRoot);
4708
4719
  }
4709
4720
  const all = [];
4710
4721
  await textSearchRecursively(all, '', handle, query);
@@ -4716,13 +4727,23 @@ const textSearch = async (scheme, root, query, options, assetDir) => {
4716
4727
  string(root);
4717
4728
  string(query);
4718
4729
  const files = getFiles();
4719
- console.log({
4720
- files
4721
- });
4722
- throw new Error('not implemented');
4730
+ const relativeRoot = root.slice('memfs://'.length);
4731
+ const allResults = [];
4732
+ for (const [key, value] of Object.entries(files)) {
4733
+ if (!key.startsWith(relativeRoot)) {
4734
+ continue;
4735
+ }
4736
+ if (value.type === File$1) {
4737
+ const relativeUri = key.slice(relativeRoot.length + 1);
4738
+ const results = textSearchInText(relativeUri, value.content, query);
4739
+ allResults.push(...results);
4740
+ }
4741
+ }
4742
+ return allResults;
4723
4743
  };
4724
4744
 
4725
4745
  const commandMap = {
4746
+ 'BulkReplacement.applyBulkReplacement': applyBulkReplacement,
4726
4747
  'ExtensionHost.launchIframeWorker': launchIframeWorker,
4727
4748
  'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
4728
4749
  'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "main": "dist/extensionHostWorkerMain.js",
6
6
  "type": "module",