Fix, add disclaimer for svelte/internal

pull/8452/head
Puru Vijay 3 years ago
parent a842562467
commit 21fe5e9810

@ -2,6 +2,10 @@
title: svelte/internal title: svelte/internal
--- ---
`svelte/internal` module gives you all the mthods and types internally used.
> WARNING: This API may change without warning. Use exports from this module with caution.
## Exports ## Exports
> EXPORTS: svelte/internal > EXPORTS: svelte/internal

@ -180,19 +180,20 @@ function munge_type_element(member, depth = 1) {
}; };
} }
/**
* Type declarations include fully qualified URLs so that they become links when
* you hover over names in an editor with TypeScript enabled. We need to remove
* the origin so that they become root-relative, so that they work in preview
* deployments and when developing locally
* @param {string} str
*/
function strip_origin(str) {
return str.replace(/https:\/\/svelte\.dev/g, '');
}
const bundled_types = await get_bundled_types(); const bundled_types = await get_bundled_types();
{
const module = bundled_types.get('svelte');
if (!module) throw new Error('Could not find svelte');
modules.push({
name: 'svelte',
comment: '',
...get_types(module.code, module.ts_source_file.statements)
});
}
{ {
const module = bundled_types.get('svelte/compiler'); const module = bundled_types.get('svelte/compiler');

@ -66,7 +66,7 @@ export function replace_placeholders(content) {
}) })
.replace(/> EXPORT_SNIPPET: (.+?)#(.+)?$/gm, (_, name, id) => { .replace(/> EXPORT_SNIPPET: (.+?)#(.+)?$/gm, (_, name, id) => {
const module = modules.find((module) => module.name === name); const module = modules.find((module) => module.name === name);
if (!module) throw new Error(`Could not find module ${name}`); if (!module) throw new Error(`Could not find module ${name} for EXPORT_SNIPPET clause`);
if (!id) { if (!id) {
throw new Error(`id is required for module ${name}`); throw new Error(`id is required for module ${name}`);

Loading…
Cancel
Save