
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
sw-builder
Advanced tools
The sw-builder package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.
The sw-builder
package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.
Install the package:
npm install -D sw-builder
Create the sw-builder.config.json
file in your project's root:
{
"outDir": "dist",
"template": "base",
"includeToPrecache": [
"/assets",
"/some-other-dir",
"/index.html",
"/logo.png",
"/splash.png"
],
"excludeFilesFromPrecache": [
"some-ignorable-file.woff2"
],
"excludeMIMETypesFromCache": [
"application/json",
"text/plain"
]
}
Include the sw-builder
binary in your package.json
file:
...
"scripts": {
"build": "tsc -b && vite build && sw-builder",
// specify a custom path for the configuration file
"build": "tsc -b && vite build && sw-builder --config='sw-custom.config.json'",
}
...
If you are using Vite include an empty sw.js
file in your public
directory so you can test the Service Worker's Registration while developing.
IBaseConfig
The configuration required to build the 'base' template. This type should be turned into a discriminated union once more templates are introduced.
type IBaseConfig = {
// the dir path in which the build's output is placed
outDir: string;
// the name of the template that will be generated
template: ITemplateName;
// the list of asset paths that will be traversed and included in the cache
includeToPrecache: string[];
// the list of file names that will be ignored
excludeFilesFromPrecache: string[];
// the list of MIME Types that won't be cached when the app sends HTTP GET requests
excludeMIMETypesFromCache: string[];
};
# unit tests
npm run test:unit
# integration tests
npm run test:integration
Install dependencies:
npm install
Build the project:
npm start
Publish to npm
:
npm publish
FAQs
The sw-builder package automates the creation of your Application's Service Worker, which pre-caches your build. This leads to a better overall performance and enables users to access your PWA without an Internet connection.
The npm package sw-builder receives a total of 2 weekly downloads. As such, sw-builder popularity was classified as not popular.
We found that sw-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.