Registry / web-framework / smash-middleware-helloworld

smash-middleware-helloworld

JSON →
library0.0.25jsnpmunverified

smash-middleware-helloworld is a middleware for the smash-cli framework, providing a simple hello world example for plugin development. Currently at version 0.0.25, it is part of the smash-cli ecosystem and demonstrates how to create custom middleware. This package is in early development (pre-1.0), with no regular release cadence. It is intended as a learning tool or starting point for building smash-cli middleware. Differentiator: tightly integrated with smash-cli, not suitable for standalone use.

npm install smash-middleware-helloworld
INSTALL
IMPORT
SIG · SMASH-MIDDLEWARE-H
S
smash-middleware-helloworld
web-frameworkjavascriptv0.0.25
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import helloWorld from 'smash-middleware-helloworld'
const helloWorld = require('smash-middleware-helloworld')
Package is ESM-only. No named exports.
helloWorld
import helloWorld from 'smash-middleware-helloworld'
The default export is the middleware function.
type definition
import helloWorld from 'smash-middleware-helloworld'; import type { Middleware } from 'smash-cli'
TypeScript users should import types from smash-cli, not from this package.

Demonstrates how to create a smash-cli app and add the hello world middleware.

import smash from 'smash-cli'; import helloWorld from 'smash-middleware-helloworld'; const app = smash(); app.use(helloWorld()); app.start();
Debug
Known issues
gotchaThis middleware requires smash-cli version >= 0.9.0. It will crash if used with older versions.
fix
Install smash-cli@>=0.9.0.
affects: >=0.0.0
breakingVersion 0.0.20 changed the export from a factory function to a default export. Direct require or import destructuring will break.
fix
Use default import: import helloWorld from 'smash-middleware-helloworld'.
affects: >=0.0.20 <0.0.25
deprecatedThe 'init' method was deprecated in v0.0.10 and removed in v0.0.15. Use the constructor directly.
fix
Replace .init() with new middleware instance.
affects: >=0.0.10 <0.0.15
gotchaThe middleware does not export TypeScript type definitions. TypeScript users may see 'could not find a declaration file' errors.
fix
Add a dummy declaration file: declare module 'smash-middleware-helloworld';
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'smash-middleware-helloworld'
Package not installed or not in NODE_PATH.
fix
Run npm install smash-middleware-helloworld
TypeError: helloWorld is not a function
Using named import or destructured require instead of default import.
fix
Use import helloWorld from 'smash-middleware-helloworld'
Uncaught SyntaxError: The requested module 'smash-middleware-helloworld' is expected to be of type CommonJS but is an ES module
Package is ESM-only, but project uses require() or outdated Node.js version.
fix
Use import syntax or set "type": "module" in package.json. Node.js >=12 required.
Upgrade
Version history
0.0.25latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
smash-middleware-helloworld — npm install smash-middleware-helloworld · libregistry