{"id":44600,"library":"command-queue-module","title":"Command Queue Module","description":"A lightweight utility (v1.0.0, stable) for creating proxy modules that queue method calls before the actual module is loaded. Unlike heavier alternatives like lazy-async (20x larger), it focuses on minimal size and a simple API. The proxy mirrors the original API exactly; queued commands replay in order once the real implementation arrives. Ideal for deferring non-critical libraries (e.g., analytics) while still collecting calls early.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","command queue","command","queue","async","lazy","load"],"install":[{"cmd":"npm install command-queue-module","lang":"bash","label":"npm"},{"cmd":"yarn add command-queue-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add command-queue-module","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; named destructuring from require() returns undefined.","wrong":"const { createCommandQueueModule } = require('command-queue-module')","symbol":"createCommandQueueModule","correct":"import createCommandQueueModule from 'command-queue-module'"},{"note":"CommonJS: use default assignment, not destructuring.","wrong":"const { createCommandQueueModule } = require('command-queue-module')","symbol":"createCommandQueueModule","correct":"const createCommandQueueModule = require('command-queue-module')"},{"note":"ESM: default import, not named import.","wrong":"import { createCommandQueueModule } from 'command-queue-module'","symbol":"createCommandQueueModule","correct":"import createCommandQueueModule from 'command-queue-module'"}],"quickstart":{"code":"import createCommandQueueModule from 'command-queue-module';\n\nconst api = createCommandQueueModule(['log', 'error'], (onLoad) => {\n  const realModule = {\n    log: (msg) => console.log('LOG:', msg),\n    error: (msg) => console.error('ERROR:', msg),\n  };\n  setTimeout(() => onLoad(realModule), 1000);\n});\n\napi.log('queued call');\napi.error('queued error');\n// After 1 second, both calls are invoked on realModule.","lang":"typescript","description":"Creates a proxy for a module with two methods; calls are queued and replayed once the real module loads after 1 second."},"warnings":[{"fix":"Switch to lazy-async or implement your own queue with ES6 Proxies.","message":"The package is no longer maintained; consider using a more modern alternative or native dynamic imports.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure all needed method names are listed in the array.","message":"Method names must be passed as strings; the proxy only exposes these methods. Unknown properties will return undefined.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always call onLoad with the real module; handle errors to prevent orphans.","message":"The loadCallback is invoked synchronously; if onLoad is never called, queued commands are lost.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'20x':30 'actual':19 'altern':25 'analyt':66 'api':40,46 'arriv':57 'async':29,77 'call':16,70 'collect':69 'command':1,49,73,75 'creat':10 'critic':63 'defer':60 'e.g':65 'earli':71 'exact':47 'focus':33 'heavier':24 'ideal':58 'implement':56 'javascript':72 'larger':31 'lazi':28,78 'lazy-async':27 'librari':64 'lightweight':5 'like':26 'load':22,79 'method':15 'minim':35 'mirror':43 'modul':3,12,20 'non':62 'non-crit':61 'order':52 'origin':45 'proxi':11,42 'queu':48 'queue':2,14,74,76 'real':55 'replay':50 'simpl':39 'size':36 'stabl':8 'still':68 'unlik':23 'util':6 'v1.0.0':7","created_at":"2026-06-07T12:50:56.228957+00:00","updated_at":"2026-06-07T12:50:56.228957+00:00","problems":[{"fix":"Use `import createCommandQueueModule from 'command-queue-module'`","cause":"Using named import instead of default import in ESM.","error":"TypeError: createCommandQueueModule is not a function"},{"fix":"Use `const createCommandQueueModule = require('command-queue-module')`","cause":"Required as object destructuring in CommonJS.","error":"Cannot read property 'trackEvent' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"command-queue-module","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}