New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nikso/adapter-serverless

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nikso/adapter-serverless

An (experimental) adapter to build a [SvelteKit](https://kit.svelte.dev/) app into a lambda ready handler for [Serverless](https://www.serverless.com/) deployment.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

adapter-serverless for SvelteKit

An (experimental) adapter to build a SvelteKit app into a lambda ready handler for Serverless deployment.

npm install --save-dev @nikso/adapter-serverless

It uses serverless-http to wrap a Polka server.

Note that because of the ESM nature of SvelteKit and the non-ESM nature of AWS lamnda, this adapter uses esbuild to compile your app in a CommonJS bundle.

Usage

In your svelte.config.cjs add the adapter like so:

const serverless = require('@nikso/adapter-serverless');
const pkg = require('./package.json');

module.exports = {
  kit: {
    adapter: serverless(),

    // NOTE that Serverless might add a "stage" fragment to URLs. You want to
    // reflect it here in `path.base` to have static files being served properly
    paths: {
      base: '/dev',
    },

    target: '#svelte',

    vite: {
      ssr: {
        noExternal: Object.keys(pkg.dependencies || {}),
      },
    },
  },
};

Example serverless.yml

After building your Svelte app with npm run build, an example Serverless configuration to run serverless offline could be:

service: svelte-app

frameworkVersion: '2'

provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221

package:
  individually: true
  exclude:
    - ./**
  include:
    - build/**

functions:
  svelte:
    handler: build/serverless.handler
    events:
      - http: ANY /
      - http: ANY /{proxy+}

plugins:
  - serverless-offline

Keywords

FAQs

Package last updated on 26 Mar 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc