@miguelmazetto/svelte-neutralino-adapter
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

svelte-neutralino-adapter

Allows SvelteKit applications to be compiled into executables using Neutralino

The advantage of Neutralino compared to Electron, is that the browser is not included, it will use the OS browser (e.g. for Windows it will be Edge). That means that instead of 100+ MB, it will be only 15 MB (For all OS included, for just one its maximum 4 MB). And the compile step is miles faster as well.

Installation

npm install --save-dev @miguelmazetto/svelte-neutralino-adapter
// svelte.config.js
import adapter from '@miguelmazetto/svelte-neutralino-adapter/adapter.js'

export default {
    kit: {
        adapter: adapter()
    },
}
// routes/+layout.ts or routes/+layout.js
export const prerender = true;

Usage

After building the first time, it generates a neutralino.config.json at your project's root folder, there you can change all neutralino configurations.

Native API

Neutralino offers a way to manipulate files and start processes, disable it if not using (it is disabled by default), because it can be a vulnerability if your application runs remote code.

Enable it at:

// neutralino.config.json
{
	...,
	"enableNativeAPI": true,
	...,
}

Initialize it at:

<!-- routes/+layout.svelte -->
<script>
	import { initNeutralino, onNeutralino } from "@miguelmazetto/svelte-neutralino-adapter";
	
	// Calls the initialization of the Native API socket
	// It is recommended to be in the root +layout.svelte
	initNeutralino(n => {
		// Execute first
		n.debug.log("First!", n.debug.LoggerType.INFO)
	})
	
	// Adds a callback for when the NativeAPI is ready.
	// If called after it is already ready, it will just
	// immediately call it. In doubt, just use it.
	// This can be placed anywhere
	onNeutralino(n => {
		// Execute second
		n.debug.log("Second!", n.debug.LoggerType.INFO)
	})
</script>

The documentation for every function is available at the Neutralino Documentation.

Package Sidebar

Install

npm i @miguelmazetto/svelte-neutralino-adapter

Weekly Downloads

2

Version

0.0.7

License

MIT

Unpacked Size

15 kB

Total Files

8

Last publish

Collaborators

  • miguelmazetto