npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@diotoborg/porro-modi-accusamus

v2.3.20

Published

[![npm](https://img.shields.io/npm/v/@diotoborg/porro-modi-accusamus.svg?style=for-the-badge)](https://www.npmjs.com/package/@diotoborg/porro-modi-accusamus) [![npm next channel](https://img.shields.io/npm/v/@diotoborg/porro-modi-accusamus/next?style=for-

Downloads

6,855

Readme

@diotoborg/porro-modi-accusamus

npm npm next channel GitHub Workflow Status

A plugin that enables us to compile an Elm application, document, or element within your Vite project. In development, hot module replacement works to some extent.

import { Elm } from './MyApplication.elm'

Elm.MyApplication.init()

Setup

npm i -D @diotoborg/porro-modi-accusamus

In vite.config.(js|ts):

import { defineConfig } from 'vite'
import elmPlugin from '@diotoborg/porro-modi-accusamus'

export default defineConfig({
  plugins: [elmPlugin()]
})

Then you can import a .elm file and run it like:

import { Elm } from './Hello.elm'

// Mount "Hello" Browser.{element,document} on #root
Elm.Hello.init({
  node: document.getElementById('root'),
  flags: "Initial Message"
})

You can explore the /example directory to experiment with an actual Vite project. Additionally, this functional website can serve as a helpful resource to learn how to use it effectively.

Options

debug (Default: process.env.NODE_ENV !== 'production')

You can control the debug mode of Elm, which toggles the Elm Debugger, by providing a boolean value.

image

elmPlugin({ debug: false })

When set to false, it disables debug mode in both development and production. Conversely, setting it to true enables debug mode even in production. It's important to note that when the production build has debug mode enabled, Elm's compiler optimizations do not take place.

optimize (Default: !debug && process.env.NODE_ENV === 'production')

You can control build optimization by providing a boolean value, which can be useful for using Debug functions in your Elm code.

elmPlugin({ debug: false, optimize: false })

When set to true, it optimizes the build and prohibits the usage of Debug Elm functions. If you specify the optimize attribute, you must indicate whether debugging is needed. This is because you might want to have debug traces for the purpose of observing all actions, not necessarily for debugging specific issues.

Static Assets Handling

This plugin supports importing assets by using a specific tag [VITE_PLUGIN_ELM_ASSET:<path to asset>] to leverage Vite's asset handling. When your Elm code contains a tag, this plugin replaces that string with the imported asset. It's important to note that the string should be a standalone string without any concatenation.

Html.img [ Html.Attributes.src "[VITE_PLUGIN_ELM_ASSET:/assets/logo.jpg]" ] []

Helper package

We can simplify the tagging process by using the Elm package elm-vite-plugin-helper:

elm install hmsk/elm-vite-plugin-helper
import VitePluginHelper

Html.img [ Html.Attributes.src <| VitePluginHelper.asset "/assets/logo.png?inline" ] []

Combine multiple main files (Experimental)

By passing importing paths via the with URL-ish parameter(s), the plugin compiles multiple main files in a single compilation process. This results in a single Elm export that contains multiple properties, each corresponding to a given main file. This feature helps reduce the bundle size when compared to importing each file separately because common modules and Elm core code are not repeated.

// `Elm.App` and `Elm.Another`, both can work as like importing individually.
import { Elm } from './App.elm?with=./Another.elm'

Elm.App.init({
  node: document.getElementById('rootForApp'),
})
Elm.Another.init({
  node: document.getElementById('rootForAnother'),
})

For 3+ main files:

import { Elm } from './App.elm?with=./Another.elm&with=./YetAnother.elm'

Acknowledgement

License

MIT