Full Code of lukeed/webpack-messages for AI

master 27c3fc4c8a4c cached
6 files
5.1 KB
1.5k tokens
5 symbols
1 requests
Download .txt
Repository: lukeed/webpack-messages
Branch: master
Commit: 27c3fc4c8a4c
Files: 6
Total size: 5.1 KB

Directory structure:
gitextract_oo1tjpef/

├── .editorconfig
├── .gitignore
├── index.js
├── license
├── package.json
└── readme.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# http://editorconfig.org
root = true

[*]
indent_size = 2
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{json,yml,md}]
indent_style = space


================================================
FILE: .gitignore
================================================
node_modules
.DS_Store
*.lock
*.log


================================================
FILE: index.js
================================================
const colors = require('kleur');
const cClear = require('console-clear');
const format = require('webpack-format-messages');

const NAME = 'webpack-messages';
const log = str => console.log(str);
const clear = _ => (cClear(true),true);

class WebpackMessages {
	constructor(opts) {
		opts = opts || {};
		this.name = opts.name;
		this.onDone = opts.onComplete;
		this.logger = opts.logger || log;
	}

	printError(str, arr) {
		arr && (str += '\n\n' + arr.join(''));
		clear() && this.logger(str);
	}

	apply(compiler) {
		const name = this.name ? ` ${colors.cyan(this.name)} bundle` : '';
		const onStart = _ => this.logger(`Building${name}...`);

		const onComplete = stats => {
			const messages = format(stats);

			if (messages.errors.length) {
				return this.printError( colors.red(`Failed to compile${name}!`), messages.errors );
			}

			if (messages.warnings.length) {
				return this.printError( colors.yellow(`Compiled${name} with warnings.`), messages.warnings );
			}

			if (this.onDone !== undefined) {
				this.onDone(name, stats);
			} else {
				const sec = (stats.endTime - stats.startTime) / 1e3;
				this.logger( colors.green(`Completed${name} in ${sec}s!`) );
			}
		};

		if (compiler.hooks !== void 0) {
			compiler.hooks.compile.tap(NAME, onStart);
			compiler.hooks.invalid.tap(NAME, _ => clear() && onStart());
			compiler.hooks.done.tap(NAME, onComplete);
		} else {
			compiler.plugin('compile', onStart);
			compiler.plugin('invalid', _ => clear() && onStart());
			compiler.plugin('done', onComplete);
		}
	}
}

module.exports = WebpackMessages;


================================================
FILE: license
================================================
MIT License

Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: package.json
================================================
{
  "name": "webpack-messages",
  "version": "2.0.4",
  "description": "Beautifully format Webpack messages throughout your bundle lifecycle(s)!",
  "repository": "lukeed/webpack-messages",
  "license": "MIT",
  "author": {
    "name": "Luke Edwards",
    "email": "luke.edwards05@gmail.com",
    "url": "lukeed.com"
  },
  "engines": {
    "node": ">=6"
  },
  "files": [
    "index.js"
  ],
  "keywords": [
    "bundle",
    "webpack",
    "create-react-app",
    "webpack-plugin",
    "formatting",
    "messages",
    "console",
    "pretty",
    "format",
    "output",
    "stats"
  ],
  "dependencies": {
    "console-clear": "^1.0.0",
    "kleur": "^3.0.0",
    "webpack-format-messages": "^2.0.0"
  }
}


================================================
FILE: readme.md
================================================
# webpack-messages

> Beautifully format Webpack messages throughout your bundle lifecycle(s)!


***Default***

<img src="shots/default.jpg" width="300" />

***Default Error***

<img src="shots/error_default.jpg" width="300" />

***Named Bundles***

<img src="shots/named.jpg" width="300" />

***Named Bundle Error***

<img src="shots/error_named.jpg" width="300" />

***Custom Logger***

<img src="shots/logger.jpg" width="300" />

***Named Bundle Error w/ Custom Logger***

<img src="shots/error_named_logger.jpg" width="300" />


## Install

```
$ npm install webpack-messages --save-dev
```


## Usage

```js
// webpack.config.js
const WebpackMessages = require('webpack-messages');

module.exports = {
  // ...
  plugins: [
    new WebpackMessages({
      name: 'client',
      logger: str => console.log(`>> ${str}`)
    })
  ]
}
```


## API

### WebpackMessages(options)

#### options.name

Type: `String`

Optionally provide a name for your bundle. Strongly recommended when compiling multiple bundles!

#### options.logger

Type: `Function`<br>
Default: `str => console.log(str)`

Replace the default function -- ideal for prepending a symbol or namespace to your messages.

Function receives a (colorized) message `string` as its only parameter.

#### options.onComplete

Type: `Function`

Run a custom function once a bundle has been compiled successfully. If provided, the default success handler will not run.

Function receives a formatted `name` string (or `''`) and the Webpack [`stats`](https://github.com/webpack/docs/wiki/node.js-api#stats) object.


## License

MIT © [Luke Edwards](https://lukeed.com)
Download .txt
gitextract_oo1tjpef/

├── .editorconfig
├── .gitignore
├── index.js
├── license
├── package.json
└── readme.md
Download .txt
SYMBOL INDEX (5 symbols across 1 files)

FILE: index.js
  constant NAME (line 5) | const NAME = 'webpack-messages';
  class WebpackMessages (line 9) | class WebpackMessages {
    method constructor (line 10) | constructor(opts) {
    method printError (line 17) | printError(str, arr) {
    method apply (line 22) | apply(compiler) {
Condensed preview — 6 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (6K chars).
[
  {
    "path": ".editorconfig",
    "chars": 211,
    "preview": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_size = 2\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trai"
  },
  {
    "path": ".gitignore",
    "chars": 36,
    "preview": "node_modules\n.DS_Store\n*.lock\n*.log\n"
  },
  {
    "path": "index.js",
    "chars": 1577,
    "preview": "const colors = require('kleur');\nconst cClear = require('console-clear');\nconst format = require('webpack-format-message"
  },
  {
    "path": "license",
    "chars": 1104,
    "preview": "MIT License\n\nCopyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n\nPermission is hereby granted, free of c"
  },
  {
    "path": "package.json",
    "chars": 712,
    "preview": "{\n  \"name\": \"webpack-messages\",\n  \"version\": \"2.0.4\",\n  \"description\": \"Beautifully format Webpack messages throughout y"
  },
  {
    "path": "readme.md",
    "chars": 1624,
    "preview": "# webpack-messages\n\n> Beautifully format Webpack messages throughout your bundle lifecycle(s)!\n\n\n***Default***\n\n<img src"
  }
]

About this extraction

This page contains the full source code of the lukeed/webpack-messages GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 6 files (5.1 KB), approximately 1.5k tokens, and a symbol index with 5 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!