broccoli-concat

Fast, good-enough concatenation with source maps.

MIT 61 个版本
安装
npm install broccoli-concat
yarn add broccoli-concat
pnpm add broccoli-concat
bun add broccoli-concat
README

Broccoli concatenator that generates & propagates sourcemaps

Build Status Build status

This filter is designed to be fast & good enough. It can generates source maps substantially faster than you'll get via mozilla/source-map, because it's special-cased for straight line-to-line contenation.

It discovers input sourcemaps in relative URLs, including data URIs.

Usage

const node = concat(node);

Advanced Usage

const node = concat(node, {
  outputFile: '/output.js',
  header: ";(function() {",
  headerFiles: ['loader.js'],
  inputFiles: ['**/*'],
  footerFiles: ['auto-start.js'],
  footer: "}());",
  sourceMapConfig: { enabled: true },
  allowNone: false | true // defaults to false, and will error if trying to concat but no files are found.
});

The structure of output.js will be as follows:

// - header
// - ordered content of the files in headerFiles
// - un-ordered content of files matched by inputFiles, but not in headerFiles or footerFiles
// - ordered content of the files in footerFiles
// - footer

Debug Usage

note: this is intended for debugging purposes only, and will most likely negatively affect your build performace is left enabled

Setting the environment variable CONCAT_STATS=true will result a summary of each concatention being output to process.cwd() + 'concat-stats-for/*.json'

Each file within that directory represents a different contenation, and will contain:

  • outputFile – the output file that was created
  • sizes – a summary of each input file, and the associated pre-minified pre-gziped byte size.

Want more details? like uglified or compressed sizes? (or have more ideas) go checkout: https://github.com/stefanpenner/broccoli-concat-analyser

Example:

concat-stats-for/-file.json

{
  "outputFile": "path/to/output/File",
  "sizes": {
    "a.js": 5,
    "b.js": 10,
  }
}

other files:

  • concat-stats-for/-file/a.js
  • concat-stats-for/-file/b.js
版本列表
4.2.7 2026-02-11
4.2.5 2021-04-14
4.2.4 2020-03-30
4.2.3 2020-02-20
4.2.2 2019-12-16
4.2.1 2019-12-16
4.2.0 2019-12-05
4.1.0 2019-12-05
4.0.0 2019-12-04
3.7.5 2019-11-11
3.7.4 2019-07-23
3.7.3 2018-10-05
3.7.2 2018-10-04
3.7.1 2018-08-28
3.7.0 2018-08-23
3.6.0 2018-08-14
3.5.1 2018-07-25
3.5.0 2018-07-25
3.4.1 2018-07-25
3.4.0 2018-07-10
3.3.1 2018-07-10
3.3.0 2018-07-10
3.2.3 2018-07-10
3.2.2 2017-02-17
3.2.1 2017-02-17
3.2.0 2017-02-16
3.1.1 2017-01-30
3.1.0 2017-01-30
3.0.5 2016-10-20
3.0.4 2016-10-05
3.0.3 2016-10-04
3.0.2 2016-08-04
3.0.1 2016-07-15
3.0.0 2016-07-14
2.3.8 2016-10-05
2.3.7 2016-10-04
2.3.6 2016-10-04
2.3.5 2016-10-04
2.3.4 2016-08-05
2.3.3 2016-07-15
2.3.2 2016-07-14
2.3.1 2016-07-14
2.3.0 2016-07-14
2.2.1 2016-07-11
2.2.0 2016-03-01
2.1.0 2016-01-06
2.0.4 2015-12-22
2.0.3 2015-12-14
0.0.13 2015-03-16
0.0.12 2014-10-13
0.0.11 2014-08-26
0.0.10 2014-08-26
0.0.9 2014-08-14
0.0.8 2014-08-04
0.0.7 2014-07-06
0.0.6 2014-04-18
0.0.5 2014-04-08
0.0.4 2014-04-08
0.0.3 2014-03-18
0.0.2 2014-02-25
0.0.1 2014-02-19