
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@jdeighan/starbucks
Advanced tools
Date: 8/27/2021
How starbucks() transforms *.starbucks files to *.svelte files:
#starbucks webpage
h1 Hello, World!
becomes
<h1>
Hello, World!
</h1>
#starbucks component
h1 Hello, World!
becomes
<h1>
Hello, World!
</h1>
NOTE: The above both produce the same output. However, handling of parameters differs between web pages and components
NOTE: The above resembles pug
syntax, but it's not.
See attributes below.
#starbucks webpage
h1 Hello, World!
p a paragraph
becomes
<h1>
Hello, World!
</h1>
<p>
a paragraph
</p>
#starbucks webpage
div
h1 Hello, World!
p a paragraph
becomes
<div>
<h1>
Hello, World!
</h1>
<p>
a paragraph
</p>
</div>
#starbucks webpage
# --- this is a comment
#
# --- this is another comment
p a paragraph
becomes
<p>
a paragraph
</p>
i.e. both comments and empty lines are ignored. A comment is a line where the first non-whitespace character is a '#' and either 1) the '#' is immediately followed by a whitespace character, or 2) there is nothing following the '#' on the line.
This is true inside script and style sections, as well as markdown. However, in #included markdown files, '# header' will be changed to 'header' followed by '======' and '##header' wil be changed to 'header' followed by '------'.
#starbucks webpage
p class=bold a paragraph
becomes
<p class="bold">
a paragraph
</p>
#starbucks webpage
p class='bold' a paragraph
becomes
<p class="bold">
a paragraph
</p>
#starbucks webpage
p class="bold" a paragraph
becomes
<p class="bold">
a paragraph
</p>
#starbucks webpage
p.bold a paragraph
becomes
<p class="bold">
a paragraph
</p>
#starbucks webpage
p.bold class="red" a paragraph
becomes
<p class="bold red">
a paragraph
</p>
#starbucks webpage
p.bold name="mine" a paragraph
becomes
<p name="mine" class="bold">
a paragraph
</p>
#starbucks webpage
p.bold name="mine" 'a paragraph'
becomes
<p name="mine" class="bold">
a paragraph
</p>
#starbucks webpage
p.bold name="mine" "a paragraph"
becomes
<p name="mine" class="bold">
a paragraph
</p>
#starbucks component (name)
h1 title
becomes
<h1>
title
</h1>
<script>
import {undef,say,ask,isEmpty,nonEmpty} from '@jdeighan/coffee-utils'
export var name = undef;
</script>
NOTE: Whenever there is a <script>
section, some common functions are
automatically imported. TO DO: check which are actually used and
only import those. Also, there should be a semicolon terminating
the import statement.
NOTE: The export statement should be indented. The blank line should not appear.
#starbucks webpage (name)
h1 title
becomes
<script context="module">
export var load = function({page}) {
return {
props: {name}
};
};
</script>
<h1>
title
</h1>
NOTE: This requires a .env file in a valid location, e.g. a
file named .env
in the same dir containing the source starbucks
file containing:
name = John
color = lightGray
Then,
#starbucks webpage
h1 My name is {{name}}
becomes
<h1>
My name is John
</h1>
#starbucks webpage
script
myName = '{{name}}'
becomes
<script>
import {undef,say,ask,isEmpty,nonEmpty} from '@jdeighan/coffee-utils'
var myName;
myName = 'John';
</script>
#starbucks webpage
style
p
background-color: {{color}}
becomes
<style>
p {
background-color: lightGray;
}
</style>
NOTE: In starbucks syntax, a command is a line on which the first non-whitespace character is '#', which is immediately followed by the name of the command, which always consists of one or more lower-case letters
#starbucks webpage
#envvar lastName = Deighan
p My last name is {{lastName}}
becomes
<p>
My last name is Deighan
</p>
#starbucks webpage
#envvar lastName = Deighan
#if known
p My last name is {{lastName}}
#else
p I don't know
becomes
{#if known }
<p>
My last name is Deighan
</p>
{:else}
<p>
I don't know
</p>
{/if}
NOTE: known
is a JavaScript variable, and if it changes,
the block of code that is displayed may change. However, lastName
is a constant at the time that this code is generated, and as such,
will always be 'Deighan'.
#starbucks webpage
#envvar lastName = Deighan
#if known
p My last name is {{lastName}}
#elsif standard
p My last name is Smith
#else
p I don't know
becomes
{#if known }
<p>
My last name is Deighan
</p>
{:else if standard }
<p>
My last name is Smith
</p>
{:else}
<p>
I don't know
</p>
{/if}
#starbucks webpage
#envvar lastName = Deighan
#for name in lNames
p My name is {name}
becomes
{#each lNames as name}
<p>
My name is {name}
</p>
{/each}
#starbucks webpage
#for name,i in lNames
p {i}. My name is {name}
becomes
{#each lNames as name,i}
<p>
{i}. My name is {name}
</p>
{/each}
#starbucks webpage
#for name,i in lNames (key = id)
p {i}. My name is {name}
becomes
{#each lNames as name,i (id)}
<p>
{i}. My name is {name}
</p>
{/each}
#starbucks webpage
#await fetch('https://disease.sh/v3/covid-19/historical/all?lastdays=30')
p please wait...
#then lData
ul
#for n,i in lData
li [{i}] {n}
#catch err
div.error {err.message}
becomes
{#await fetch('https://disease.sh/v3/covid-19/historical/all?lastdays=30')}
<p>
please wait...
</p>
{:then lData}
<ul>
{#each lData as n,i}
<li>
[{i}] {n}
</li>
{/each}
</ul>
{:catch err}
<div class="error">
{err.message}
</div>
{/await}
#starbucks webpage
h1.error
p.message {err.message}
p.solution Please set env var dir_root
style
h1.error
p.message
background-color: red
p.solution
background-color: orange
becomes
<h1 class="error">
<p class="message">
{err.message}
</p>
<p class="solution">
Please set env var dir_root
</p>
</h1>
<style>
h1.error p.message {
background-color: red;
}
h1.error p.solution {
background-color: orange;
}
</style>
becomes
FAQs
A svelte language extension
We found that @jdeighan/starbucks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.