{"id":18798,"library":"smash-middleware-helloworld","title":"smash-middleware-helloworld","description":"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.","status":"active","version":"0.0.25","language":"javascript","source_language":"en","source_url":"https://github.com/chenhaihong/smash-cli","tags":["javascript","smash","smash-cli","smash middleware","hello world"],"install":[{"cmd":"npm install smash-middleware-helloworld","lang":"bash","label":"npm"},{"cmd":"yarn add smash-middleware-helloworld","lang":"bash","label":"yarn"},{"cmd":"pnpm add smash-middleware-helloworld","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only. No named exports.","wrong":"const helloWorld = require('smash-middleware-helloworld')","symbol":"default","correct":"import helloWorld from 'smash-middleware-helloworld'"},{"note":"The default export is the middleware function.","symbol":"helloWorld","correct":"import helloWorld from 'smash-middleware-helloworld'"},{"note":"TypeScript users should import types from smash-cli, not from this package.","symbol":"type definition","correct":"import helloWorld from 'smash-middleware-helloworld'; import type { Middleware } from 'smash-cli'"}],"quickstart":{"code":"import smash from 'smash-cli';\nimport helloWorld from 'smash-middleware-helloworld';\n\nconst app = smash();\napp.use(helloWorld());\napp.start();","lang":"typescript","description":"Demonstrates how to create a smash-cli app and add the hello world middleware."},"warnings":[{"fix":"Install smash-cli@>=0.9.0.","message":"This middleware requires smash-cli version >= 0.9.0. It will crash if used with older versions.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use default import: import helloWorld from 'smash-middleware-helloworld'.","message":"Version 0.0.20 changed the export from a factory function to a default export. Direct require or import destructuring will break.","severity":"breaking","affected_versions":">=0.0.20 <0.0.25"},{"fix":"Replace .init() with new middleware instance.","message":"The 'init' method was deprecated in v0.0.10 and removed in v0.0.15. Use the constructor directly.","severity":"deprecated","affected_versions":">=0.0.10 <0.0.15"},{"fix":"Add a dummy declaration file: declare module 'smash-middleware-helloworld';","message":"The middleware does not export TypeScript type definitions. TypeScript users may see 'could not find a declaration file' errors.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install smash-middleware-helloworld","cause":"Package not installed or not in NODE_PATH.","error":"Error: Cannot find module 'smash-middleware-helloworld'"},{"fix":"Use import helloWorld from 'smash-middleware-helloworld'","cause":"Using named import or destructured require instead of default import.","error":"TypeError: helloWorld is not a function"},{"fix":"Use import syntax or set \"type\": \"module\" in package.json. Node.js >=12 required.","cause":"Package is ESM-only, but project uses require() or outdated Node.js version.","error":"Uncaught SyntaxError: The requested module 'smash-middleware-helloworld' is expected to be of type CommonJS but is an ES module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}