Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
The perfect middleware between your static file server and the browser. Minifies, compresses, and caches files served to the client. If it's JS or CSS, it also transpiles unsupported features of the target browser. You may also use this in your build process to create browser-specific builds. It's traceur and myth on steroids.
The goal of this project is to create a frontend flow where:
Combined with polyfills, you can use most of the latest features of browsers with relative ease.
There's no:
Features:
var Ecstacy = require('ecstacy')
The cache folder where all the transpiled JS, minified, and gzipped files are saved.
This build folder is global, but because code is cached based on a
sha256
sum, there should not be any conflicts.
Delete the entire cache folder.
Per-file lru
cache options. Defaults to:
max
- 100
maxAge
- Infinity
These cache useragent -> transforms
lookups per instance.
Each cached object is pretty low memory since they are simply references to objects already in memory.
All Ecstacy
constructors have the following API:
Create a new instance. Some options are:
name
- the name of the file, specifically for source mapsmap
- the source map, if any"Builds" a version of the file according to agents
.
agents
is simply passed tp polyfills-db.
data
is an object with the following properties:
name
- the name of the file of the builddate
- the date this build was created for Last-Modified
headershash
- a sha256
sha sum of the JS file in hex
encoding for ETag
headerstransforms[]
- an array of all the transform names usedlength[extension]
- the byte size of each build for Content-Length
headersRead a file by its data.name
and extension
.
Returns a Buffer
, so you need to .toString()
it yourself.
var ecstacy = Ecstacy(code)
ecstacy.build(useragent).then(function (data) {
return ecstacy.read(data.name, '.js', 'utf8')
}).then(function (js) {
})
You may want to serve the smallest of data.length['.min.js.gz']
and data.length['.min.js']
if you like to over-optimize.
You also probably don't need to stringify the buffer to send it to the client.
Create a read stream for a file and extension instead of buffering it. Useful when serving files to the client.
Minify the asset and add its content length to data.length
.
Minify an already existing file by its name and extension,
and add its content length to data.length
.
By default, source maps are always enabled.
However, there is a performance penalty when using source maps.
You may opt out of source maps by setting ecstacy.sourcemaps = false
on every Ecstacy
instance.
Switching .sourcemaps
between true
or false
is not supported
as files will be cached differently every time.
Everytime you switch .sourcemaps
' value,
you must run Ecstacy.clean()
to clean the cache.
Some additional options are:
code
- the JS codeSome additional fields:
transforms[]
- an array of all the transform names usedAll the possible extensions:
.json
- the returns data.js
.js.gz
.js.map
.js.map.gz
.min.js
.min.js.gz
.min.js.map
.min.js.map.gz
FAQs
transpile JS based on user agents
The npm package ecstacy receives a total of 1 weekly downloads. As such, ecstacy popularity was classified as not popular.
We found that ecstacy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.