Skip to content

Commit

Permalink
[v2.0.0] Remove @types dependencies (#3395)
Browse files Browse the repository at this point in the history
* Replace Buffer with UInt8Array and get rid of Node types dependency

* Git rid of ESTree dependency by using a specialized version of acorn's Node type

* Fix test and adjust documentation
  • Loading branch information
lukastaegert committed Feb 26, 2020
1 parent bbfe4a5 commit 1e393ef
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 130 deletions.
62 changes: 31 additions & 31 deletions LICENSE.md
Expand Up @@ -31,7 +31,7 @@ MIT, ISC
## acorn
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: https://github.com/acornjs/acorn.git
Repository: git+https://github.com/acornjs/acorn.git

> Copyright (C) 2012-2018 by various contributors (see AUTHORS)
>
Expand All @@ -58,7 +58,7 @@ Repository: https://github.com/acornjs/acorn.git
## acorn-export-ns-from
License: MIT
By: Adrian Heine
Repository: https://github.com/acornjs/acorn-export-ns-from
Repository: git+https://github.com/acornjs/acorn-export-ns-from.git

> Copyright (C) 2017-2018 by Adrian Heine
>
Expand All @@ -85,7 +85,7 @@ Repository: https://github.com/acornjs/acorn-export-ns-from
## acorn-import-meta
License: MIT
By: Adrian Heine
Repository: https://github.com/adrianheine/acorn-import-meta
Repository: git+https://github.com/adrianheine/acorn-import-meta.git

> Copyright (C) 2017-2018 by Adrian Heine
>
Expand All @@ -112,7 +112,7 @@ Repository: https://github.com/adrianheine/acorn-import-meta
## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: https://github.com/acornjs/acorn.git
Repository: git+https://github.com/acornjs/acorn.git

> Copyright (C) 2012-2018 by various contributors (see AUTHORS)
>
Expand All @@ -139,7 +139,7 @@ Repository: https://github.com/acornjs/acorn.git
## anymatch
License: ISC
By: Elan Shanker
Repository: https://github.com/micromatch/anymatch
Repository: git+https://github.com/micromatch/anymatch.git

> The ISC License
>
Expand All @@ -162,14 +162,14 @@ Repository: https://github.com/micromatch/anymatch
## binary-extensions
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/binary-extensions
Repository: git+https://github.com/sindresorhus/binary-extensions.git

---------------------------------------

## braces
License: MIT
By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
Repository: micromatch/braces
Repository: git+https://github.com/micromatch/braces.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -227,7 +227,7 @@ Repository: git+https://github.com/paulmillr/chokidar.git
## colorette
License: MIT
By: Jorge Bucaran
Repository: jorgebucaran/colorette
Repository: git+https://github.com/jorgebucaran/colorette.git

> Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
>
Expand All @@ -242,14 +242,14 @@ Repository: jorgebucaran/colorette
## date-time
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/date-time
Repository: git+https://github.com/sindresorhus/date-time.git

---------------------------------------

## fill-range
License: MIT
By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
Repository: jonschlinkert/fill-range
Repository: git+https://github.com/jonschlinkert/fill-range.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -278,7 +278,7 @@ Repository: jonschlinkert/fill-range
## glob-parent
License: ISC
By: Gulp Team, Elan Shanker, Blaine Bublitz
Repository: gulpjs/glob-parent
Repository: git+https://github.com/gulpjs/glob-parent.git

> The ISC License
>
Expand All @@ -301,13 +301,13 @@ Repository: gulpjs/glob-parent
## hash.js
License: MIT
By: Fedor Indutny
Repository: git@github.com:indutny/hash.js
Repository: git+ssh://git@github.com/indutny/hash.js.git

---------------------------------------

## inherits
License: ISC
Repository: git://github.com/isaacs/inherits
Repository: git://github.com/isaacs/inherits.git

> The ISC License
>
Expand All @@ -330,14 +330,14 @@ Repository: git://github.com/isaacs/inherits
## is-binary-path
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/is-binary-path
Repository: git+https://github.com/sindresorhus/is-binary-path.git

---------------------------------------

## is-extglob
License: MIT
By: Jon Schlinkert
Repository: jonschlinkert/is-extglob
Repository: git+https://github.com/jonschlinkert/is-extglob.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -366,7 +366,7 @@ Repository: jonschlinkert/is-extglob
## is-glob
License: MIT
By: Jon Schlinkert, Brian Woodward, Daniel Perez
Repository: micromatch/is-glob
Repository: git+https://github.com/micromatch/is-glob.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -395,7 +395,7 @@ Repository: micromatch/is-glob
## is-number
License: MIT
By: Jon Schlinkert, Olsten Larck, Rouven Weßling
Repository: jonschlinkert/is-number
Repository: git+https://github.com/jonschlinkert/is-number.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -431,14 +431,14 @@ Repository: git+https://github.com/Rich-Harris/is-reference.git
## locate-character
License: MIT
By: Rich Harris
Repository: Rich-Harris/locate-character
Repository: git+https://github.com/Rich-Harris/locate-character.git

---------------------------------------

## magic-string
License: MIT
By: Rich Harris
Repository: https://github.com/rich-harris/magic-string
Repository: git+https://github.com/rich-harris/magic-string.git

> Copyright 2018 Rich Harris
>
Expand All @@ -453,7 +453,7 @@ Repository: https://github.com/rich-harris/magic-string
## micromatch
License: MIT
By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright
Repository: micromatch/micromatch
Repository: git+https://github.com/micromatch/micromatch.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -481,7 +481,7 @@ Repository: micromatch/micromatch

## minimalistic-assert
License: ISC
Repository: https://github.com/calvinmetcalf/minimalistic-assert.git
Repository: git+https://github.com/calvinmetcalf/minimalistic-assert.git

> Copyright 2015 Calvin Metcalf
>
Expand Down Expand Up @@ -528,7 +528,7 @@ Repository: git://github.com/substack/minimist.git
## normalize-path
License: MIT
By: Jon Schlinkert, Blaine Bublitz
Repository: jonschlinkert/normalize-path
Repository: git+https://github.com/jonschlinkert/normalize-path.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -557,14 +557,14 @@ Repository: jonschlinkert/normalize-path
## parse-ms
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/parse-ms
Repository: git+https://github.com/sindresorhus/parse-ms.git

---------------------------------------

## picomatch
License: MIT
By: Jon Schlinkert
Repository: micromatch/picomatch
Repository: git+https://github.com/micromatch/picomatch.git

> The MIT License (MIT)
>
Expand Down Expand Up @@ -593,14 +593,14 @@ Repository: micromatch/picomatch
## pretty-bytes
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/pretty-bytes
Repository: git+https://github.com/sindresorhus/pretty-bytes.git

---------------------------------------

## pretty-ms
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/pretty-ms
Repository: git+https://github.com/sindresorhus/pretty-ms.git

---------------------------------------

Expand Down Expand Up @@ -643,14 +643,14 @@ Repository: git://github.com/kamicane/require-relative.git
## rollup-pluginutils
License: MIT
By: Rich Harris
Repository: rollup/rollup-pluginutils
Repository: git+https://github.com/rollup/rollup-pluginutils.git

---------------------------------------

## signal-exit
License: ISC
By: Ben Coe
Repository: https://github.com/tapjs/signal-exit.git
Repository: git+https://github.com/tapjs/signal-exit.git

> The ISC License
>
Expand All @@ -674,7 +674,7 @@ Repository: https://github.com/tapjs/signal-exit.git
## sourcemap-codec
License: MIT
By: Rich Harris
Repository: https://github.com/Rich-Harris/sourcemap-codec
Repository: git+https://github.com/Rich-Harris/sourcemap-codec.git

> The MIT License
>
Expand Down Expand Up @@ -703,14 +703,14 @@ Repository: https://github.com/Rich-Harris/sourcemap-codec
## time-zone
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/time-zone
Repository: git+https://github.com/sindresorhus/time-zone.git

---------------------------------------

## to-regex-range
License: MIT
By: Jon Schlinkert, Rouven Weßling
Repository: micromatch/to-regex-range
Repository: git+https://github.com/micromatch/to-regex-range.git

> The MIT License (MIT)
>
Expand Down
2 changes: 1 addition & 1 deletion cli/run/build.ts
Expand Up @@ -48,7 +48,7 @@ export default function build(

return bundle.generate(output).then(({ output: outputs }) => {
for (const file of outputs) {
let source: string | Buffer;
let source: string | Uint8Array;
if (file.type === 'asset') {
source = file.source;
} else {
Expand Down
2 changes: 1 addition & 1 deletion docs/02-javascript-api.md
Expand Up @@ -29,7 +29,7 @@ async function build() {
// For assets, this contains
// {
// fileName: string, // the asset file name
// source: string | Buffer // the asset source
// source: string | UInt8Array // the asset source
// type: 'asset' // signifies that this is an asset
// }
console.log('Asset', chunkOrAsset);
Expand Down
12 changes: 6 additions & 6 deletions docs/05-plugin-development.md
Expand Up @@ -131,7 +131,7 @@ Called at the end of `bundle.generate()` or immediately before the files are wri
// AssetInfo
{
fileName: string,
source: string | Buffer,
source: string | UInt8Array,
type: 'asset',
}
Expand Down Expand Up @@ -429,7 +429,7 @@ Emits a new file that is included in the build output and returns a `referenceId
// EmittedAsset
{
type: 'asset',
source?: string | Buffer,
source?: string | UInt8Array,
name?: string,
fileName?: string
}
Expand All @@ -443,7 +443,7 @@ The generated code that replaces `import.meta.ROLLUP_FILE_URL_referenceId` can b

If the `type` is *`chunk`*, then this emits a new chunk with the given module id as entry point. This will not result in duplicate modules in the graph, instead if necessary, existing chunks will be split or a facade chunk with reexports will be created. Chunks with a specified `fileName` will always generate separate chunks while other emitted chunks may be deduplicated with existing chunks even if the `name` does not match. If such a chunk is not deduplicated, the [`output.chunkFileNames`](guide/en/#outputchunkfilenames) name pattern will be used.

If the `type` is *`asset`*, then this emits an arbitrary new file with the given `source` as content. It is possible to defer setting the `source` via [`this.setAssetSource(assetReferenceId, source)`](guide/en/#thissetassetsourceassetreferenceid-string-source-string--buffer--void) to a later time to be able to reference a file during the build phase while setting the source separately for each output during the generate phase. Assets with a specified `fileName` will always generate separate files while other emitted assets may be deduplicated with existing assets if they have the same source even if the `name` does not match. If such an asset is not deduplicated, the [`output.assetFileNames`](guide/en/#outputassetfilenames) name pattern will be used.
If the `type` is *`asset`*, then this emits an arbitrary new file with the given `source` as content. It is possible to defer setting the `source` via [`this.setAssetSource(assetReferenceId, source)`](guide/en/#thissetassetsourceassetreferenceid-string-source-string--uint8array--void) to a later time to be able to reference a file during the build phase while setting the source separately for each output during the generate phase. Assets with a specified `fileName` will always generate separate files while other emitted assets may be deduplicated with existing assets if they have the same source even if the `name` does not match. If such an asset is not deduplicated, the [`output.assetFileNames`](guide/en/#outputassetfilenames) name pattern will be used.

#### `this.error(error: string | Error, position?: number | { column: number; line: number }) => never`

Expand Down Expand Up @@ -496,9 +496,9 @@ Resolve imports to module ids (i.e. file names) using the same plugins that Roll

If you pass `skipSelf: true`, then the `resolveId` hook of the plugin from which `this.resolve` is called will be skipped when resolving.

#### `this.setAssetSource(assetReferenceId: string, source: string | Buffer) => void`
#### `this.setAssetSource(assetReferenceId: string, source: string | UInt8Array) => void`

Set the deferred source of an asset.
Set the deferred source of an asset. Note that you can also pass a Node `Buffer` as `source` as it is a sub-class of `UInt8Array`.

#### `this.warn(warning: string | RollupWarning, position?: number | { column: number; line: number }) => void`

Expand All @@ -520,7 +520,7 @@ The `position` argument is a character index where the warning was raised. If pr

☢️ These context utility functions have been deprecated and may be removed in a future Rollup version.

- `this.emitAsset(assetName: string, source: string) => string` - _**Use [`this.emitFile`](guide/en/#thisemitfileemittedfile-emittedchunk--emittedasset--string)**_ - Emits a custom file that is included in the build output, returning an `assetReferenceId` that can be used to reference the emitted file. You can defer setting the source if you provide it later via [`this.setAssetSource(assetReferenceId, source)`](guide/en/#thissetassetsourceassetreferenceid-string-source-string--buffer--void). A string or Buffer source must be set for each asset through either method or an error will be thrown on generate completion.
- `this.emitAsset(assetName: string, source: string) => string` - _**Use [`this.emitFile`](guide/en/#thisemitfileemittedfile-emittedchunk--emittedasset--string)**_ - Emits a custom file that is included in the build output, returning an `assetReferenceId` that can be used to reference the emitted file. You can defer setting the source if you provide it later via [`this.setAssetSource(assetReferenceId, source)`](guide/en/#thissetassetsourceassetreferenceid-string-source-string--uint8array--void). A string or `UInt8Array`/`Buffer` source must be set for each asset through either method or an error will be thrown on generate completion.

Emitted assets will follow the [`output.assetFileNames`](guide/en/#outputassetfilenames) naming scheme. You can reference the URL of the file in any code returned by a [`load`](guide/en/#load) or [`transform`](guide/en/#transform) plugin hook via `import.meta.ROLLUP_ASSET_URL_assetReferenceId`.

Expand Down

0 comments on commit 1e393ef

Please sign in to comment.