{"id":17497536,"url":"https://github.com/moox/postcss-message-helpers","last_synced_at":"2025-06-30T10:07:18.277Z","repository":{"id":23716129,"uuid":"27088842","full_name":"MoOx/postcss-message-helpers","owner":"MoOx","description":"PostCSS helpers to throw or output GNU style messages","archived":false,"fork":false,"pushed_at":"2024-07-02T10:29:03.000Z","size":349,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-25T00:56:55.974Z","etag":null,"topics":["javascript","postcss","postcss-helpers"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MoOx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"tidelift":"npm/postcss-message-helpers"}},"created_at":"2014-11-24T18:29:44.000Z","updated_at":"2024-07-02T10:29:07.000Z","dependencies_parsed_at":"2024-06-18T16:50:20.515Z","dependency_job_id":"cdc4156f-b20d-46cc-8ac6-b87b5f764227","html_url":"https://github.com/MoOx/postcss-message-helpers","commit_stats":{"total_commits":32,"total_committers":3,"mean_commits":"10.666666666666666","dds":0.5,"last_synced_commit":"43401da0ebaec3d3c4e8b16e1f7448e92e8680bb"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/MoOx/postcss-message-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Fpostcss-message-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Fpostcss-message-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Fpostcss-message-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Fpostcss-message-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MoOx","download_url":"https://codeload.github.com/MoOx/postcss-message-helpers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoOx%2Fpostcss-message-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262753170,"owners_count":23358883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","postcss","postcss-helpers"],"created_at":"2024-10-19T15:55:32.576Z","updated_at":"2025-06-30T10:07:18.235Z","avatar_url":"https://github.com/MoOx.png","language":"JavaScript","funding_links":["https://tidelift.com/funding/github/npm/postcss-message-helpers","https://tidelift.com/subscription/pkg/npm-postcss-message-helpers?utm_source=npm-postcss-message-helpers\u0026utm_medium=referral\u0026utm_campaign=readme","https://tidelift.com/security"],"categories":[],"sub_categories":[],"readme":"# postcss-message-helpers\n\n[![Build Status](https://github.com/MoOx/postcss-message-helpers/workflows/Build/badge.svg)](https://github.com/MoOx/postcss-message-helpers/actions)\n\n---\n\n[Professionally supported postcss-message-helpers is now available](https://tidelift.com/subscription/pkg/npm-postcss-message-helpers?utm_source=npm-postcss-message-helpers\u0026utm_medium=referral\u0026utm_campaign=readme)\n\n---\n\n\u003e [PostCSS](https://github.com/postcss/postcss) helpers to throw or output GNU\n\u003e style messages.\n\nThis modules offers you some function to throw or just output messages with\n[GNU style](https://www.gnu.org/prep/standards/html_node/Errors.html):\n`sourcefile:lineno:column: message`\n\n## Installation\n\n```console\n$ npm install postcss-message-helpers\n```\n\n```js\nvar messageHelpers = require(\"postcss-message-helpers\");\n```\n\n## Usage\n\n### `var fnValue = messageHelpers.try(fn, source)`\n\nExecute `fn` an return the value. If an exception is thrown during the process,\nthe exception will be catched, enhanced from source \u0026 re-throw.\n\n### `var sourceMessage = messageHelpers.message(message, source)`\n\nReturns a message like `sourcefile:lineno:column: message`.  \n`source` should be a postcss source object from a node.\n\n### `var source = messageHelpers.source(source)`\n\nReturns `sourcefile:lineno:column` for a given `source` postcss object.\n\n### Example\n\n```js\n// dependencies\nvar fs = require(\"fs\");\nvar postcss = require(\"postcss\");\nvar messageHelpers = require(\"postcss-message-helpers\");\n\n// css to be processed\nvar css = fs.readFileSync(\"input.css\", \"utf8\");\n\n// process css\nvar output = postcss()\n  .use(function(styles) {\n    styles.eachDecl(function transformDecl(decl) {\n      // will catch, adjust error stack, line, column \u0026 message (gnu style) then re-throw\n      messageHelpers.try(function IwillThrow() {\n        if (decl.value.indexOf(\"error(\") \u003e -1) {\n          throw new Error(\"error detected: \" + decl.value);\n        }\n      }, decl.source);\n\n      // will output a gnu style warning\n      if (decl.value.indexOf(\"warning(\") \u003e -1) {\n        console.warning(\n          messageHelpers.message(\"warning: \" + decl.value, decl.source)\n        );\n      }\n    });\n  })\n  .process(css).css;\n```\n\nCheckout [tests](test) for more examples.\n\n---\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style \u0026 run tests\nbefore submitting a bug fix or a feature.\n\n    $ git clone https://github.com/MoOx/postcss-message-helpers.git\n    $ git checkout -b patch-1\n    $ npm install\n    $ npm test\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n\n## Security contact information\n\nTo report a security vulnerability, please use the\n[Tidelift security contact](https://tidelift.com/security). Tidelift will\ncoordinate the fix and disclosure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoox%2Fpostcss-message-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoox%2Fpostcss-message-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoox%2Fpostcss-message-helpers/lists"}