-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export
sveld
for programmatic usage (#66)
- Loading branch information
Showing
4 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default } from "./rollup-plugin"; | ||
export { default as ComponentParser } from "./ComponentParser"; | ||
export { cli } from "./cli"; | ||
export { sveld } from "./sveld"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getSvelteEntry } from "./get-svelte-entry"; | ||
import { PluginSveldOptions, generateBundle, writeOutput } from "./rollup-plugin"; | ||
|
||
interface SveldOptions extends PluginSveldOptions { | ||
/** | ||
* Specify the input to the uncompiled Svelte source. | ||
* If no value is provided, `sveld` will attempt to infer | ||
* the entry point from the `package.json#svelte` field. | ||
*/ | ||
input?: string; | ||
} | ||
|
||
export async function sveld(opts?: SveldOptions) { | ||
const input = getSvelteEntry(opts?.input); | ||
if (input === null) return; | ||
const result = await generateBundle(input, opts?.glob === true); | ||
writeOutput(result, opts || {}, input); | ||
} |