Skip to content

Commit

Permalink
minor fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Apr 19, 2023
1 parent f6484c4 commit a4c7f40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jspm link ./src/cli.js
Link an HTML file and update its import map including preload and integrity tags

```
jspm link --map index.html --integrity --preload static
jspm link --map index.html --integrity --preload dynamic
```
## install

Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ cli
(
name
) => `Link an HTML file and update its import map including preload and integrity tags
$ ${name} link --map index.html --integrity --preload static
$ ${name} link --map index.html --integrity --preload dynamic
`
)
.usage(
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function getCacheMode(flags: Flags): "offline" | boolean {
}

const validPreloadModes = ["static", "dynamic"];
function getPreloadMode(flags: Flags): boolean | string {
function getPreloadMode(flags: Flags): boolean | 'static' | 'all' {
if (flags.preload === null || flags.preload === undefined) return false;
if (typeof flags.preload === "boolean") {
return flags.preload;
Expand All @@ -382,11 +382,11 @@ function getPreloadMode(flags: Flags): boolean | string {
throw new JspmError(
`Invalid preload mode "${
flags.preload
}". Available modes are: "${validPreloadModes.join('", "')}".\n\t${c.bold(
}". Available modes are: "${validPreloadModes.join('", "')}" (default).\n\t${c.bold(
"static"
)} Inject preload tags for static dependencies.\n\t${c.bold(
"dynamic"
)} Inject preload tags for static and dynamic dependencies.`
)} Inject preload tags for static and dynamic dependencies.`
);

if (flags.preload === "static") return "static";
Expand Down

0 comments on commit a4c7f40

Please sign in to comment.