You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: streamline Twoslash instance creation and caching logic
* chore: add changeset for fixing Twoslasher instance creation
* refactor: initialize Twoslash-related variables and improve module resolution logic
* refactor: remove unused variables and simplify Twoslash function logic
* refactor: enhance Twoslasher instance management and caching logic
* docs: add note on compilerOptions.lib for Astro build errors
* refactor: update tsdown configuration to use deps for onlyAllowBundle
* docs: update installation guide to address memory issues during Astro builds
* refactor: improve ecEngine initialization and clarify singleton usage in ecTwoSlash
* refactor: initialize includesMap only if it is not already set
* refactor: lazy load createTwoslasher to improve performance
* refactor: update file patterns in labeler.yml for improved matching
Copy file name to clipboardExpand all lines: docs/src/content/docs/getting-started/installation.mdx
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,4 +176,16 @@ ecTwoSlash({
176
176
});
177
177
```
178
178
179
+
#### A note about Memory Issues
179
180
181
+
If you are running Astro, and run into build errors about running out of memory, you may need to change the `lib` option to be more specific or empty. By default, EC Twoslash includes the following libs:
* Interface representing the data structure for a Twoslash instance, including its trigger pattern, supported languages, and the corresponding twoslasher functions.
* Retrieves or creates a base Twoslash instance and caches it in the `TwoslasherMap` for future use. If an instance already exists for the "twoslash" key, it returns the cached instance; otherwise, it creates a new one using the provided options and stores it in the map before returning it.
* Retrieves or creates a Twoslash instance specific to Vue and caches it in the `TwoslasherMap` for future use. If an instance already exists for the "twoslash-vue" key, it returns the cached instance; otherwise, it attempts to create a new one using the provided options and stores it in the map before returning it. If the module fails to load, it logs an error and throws a new error with a user-friendly message.
console.error("Failed to load twoslash-vue:",error);
108
+
thrownewError("Failed to load twoslash-vue. Please ensure vue is installed and try again.");
109
+
}
110
+
}
111
+
returntwoslasher;
112
+
};
113
+
114
+
/**
115
+
* Retrieves or creates a Twoslash instance specific to ESLint and caches it in the `TwoslasherMap` for future use. If an instance already exists for the "eslint" key, it returns the cached instance; otherwise, it attempts to create a new one using the provided options and stores it in the map before returning it. If the module fails to load, it logs an error and throws a new error with a user-friendly message.
console.error("Failed to load twoslash-eslint:",error);
133
+
thrownewError(
134
+
"Failed to load twoslash-eslint. Please ensure eslint is installed and try again.",
135
+
);
136
+
}
137
+
}
138
+
returntwoslasher;
139
+
};
140
+
73
141
/**
74
142
* A map that holds the configuration for built-in twoslash instances, including their trigger patterns, supported languages, and the corresponding twoslasher functions.
0 commit comments