mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Updated deprecated and moved properties
Renamed properties: https://github.com/rollup/rollup/blob/6fc2088bfaf6b47b7225223398d1335f167a0aea/src/rollup/index.js#L82-L88 Paths as an output option: https://github.com/rollup/rollup/blob/master/CHANGELOG.md#0482
This commit is contained in:
Vendored
+16
-16
@@ -29,9 +29,14 @@ export interface BundleOptions {
|
||||
/** An ID to use for AMD/UMD bundles. */
|
||||
moduleId?: string
|
||||
/** The name to use for the module for UMD/IIFE bundles (required for bundles with exports). */
|
||||
moduleName?: string
|
||||
name?: string
|
||||
/** Mapping of IDs → global variable names. Used for UMD/IIFE bundles. */
|
||||
globals?: { [id: string]: string }
|
||||
/**
|
||||
* Function that takes an ID and returns a path, or Object of id: path pairs.
|
||||
* Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN.
|
||||
*/
|
||||
paths?: ((id: string) => string) | { [id: string]: string }
|
||||
/**
|
||||
* The indent string to use, for formats that require code to be indented (AMD, IIFE, UMD).
|
||||
* Can also be false (no indent), or true (the default – auto-indent)
|
||||
@@ -55,26 +60,26 @@ export interface BundleOptions {
|
||||
* Whether to include the 'use strict' pragma at the top of generated non-ES6 bundles.
|
||||
* Strictly-speaking (geddit?), ES6 modules are always in strict mode, so you shouldn't disable this without good reason.
|
||||
*/
|
||||
useStrict?: boolean
|
||||
strict?: boolean
|
||||
}
|
||||
|
||||
export interface GenerateOptions extends BundleOptions {
|
||||
/** Whether to generate a sourcemap. If true, the return value from `bundle.generate(...)` will include a map property */
|
||||
sourceMap?: boolean
|
||||
sourcemap?: boolean
|
||||
/**
|
||||
* The location of the generated bundle. If this is an absolute path, all the sources paths in the sourcemap will be relative to it.
|
||||
* The map.file property is the basename of sourceMapFile, as the location of the sourcemap is assumed to be adjacent to the bundle.
|
||||
* The map.file property is the basename of sourcemapFile, as the location of the sourcemap is assumed to be adjacent to the bundle.
|
||||
*/
|
||||
sourceMapFile?: string
|
||||
sourcemapFile?: string
|
||||
}
|
||||
|
||||
export interface WriteOptions extends BundleOptions {
|
||||
/** The file to write to. If `options.sourceMap === true`, two files will be created – `dest` and `dest + '.map`. */
|
||||
dest: string
|
||||
/** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting dest file as a data URI. */
|
||||
sourceMap?: boolean | 'inline'
|
||||
/** This option is unnecessary, as it defaults to the value of dest. */
|
||||
sourceMapFile?: string
|
||||
/** The file to write to. If `options.sourcemap === true`, two files will be created – `file` and `file + '.map`. */
|
||||
file: string
|
||||
/** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting file as a data URI. */
|
||||
sourcemap?: boolean | 'inline'
|
||||
/** This option is unnecessary, as it defaults to the value of file. */
|
||||
sourcemapFile?: string
|
||||
}
|
||||
|
||||
export interface Bundle {
|
||||
@@ -94,11 +99,6 @@ export interface Options {
|
||||
* The IDs should be either the name of an external dependency or a resolved ID (like an absolute path to a file)
|
||||
*/
|
||||
external?: ((id: string) => boolean) | string[]
|
||||
/**
|
||||
* Function that takes an ID and returns a path, or Object of id: path pairs.
|
||||
* Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN.
|
||||
*/
|
||||
paths?: ((id: string) => string) | { [id: string]: string }
|
||||
/** Function that will intercept warning messages. If not supplied, warnings will be deduplicated and printed to the console. */
|
||||
onwarn?(warning: Warning): void
|
||||
/** Array of plugin objects or a single plugin object */
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { rollup, Bundle, Plugin } from 'rollup'
|
||||
|
||||
let console: any
|
||||
|
||||
let cache: Bundle | undefined
|
||||
let plugin: Plugin
|
||||
|
||||
@@ -8,6 +10,16 @@ async function main() {
|
||||
input: 'main.js',
|
||||
external: ['external-module'],
|
||||
plugins: [plugin],
|
||||
onwarn: ({ code, frame, loc, message }) => {
|
||||
if (loc) {
|
||||
const { file, line, column } = loc
|
||||
console.log(`[${code}] - ${file}(${line},${column}): ${message}`)
|
||||
} else {
|
||||
console.log(`[${code}] - ${message}`)
|
||||
}
|
||||
|
||||
if (frame) console.warn(frame)
|
||||
},
|
||||
cache,
|
||||
})
|
||||
|
||||
@@ -20,13 +32,16 @@ async function main() {
|
||||
const result = bundle.generate({
|
||||
format: 'cjs',
|
||||
indent: false,
|
||||
sourcemap: true,
|
||||
})
|
||||
|
||||
cache = bundle
|
||||
|
||||
await bundle.write({
|
||||
format: 'cjs',
|
||||
dest: 'bundle.js',
|
||||
file: 'bundle.js',
|
||||
name: 'myLib',
|
||||
interop: false,
|
||||
globals: {
|
||||
jquery: '$',
|
||||
lodash: '_',
|
||||
@@ -36,6 +51,9 @@ async function main() {
|
||||
intro: 'var ENV = "production";',
|
||||
outro: 'var VERSION = "1.0.0";',
|
||||
indent: ' ',
|
||||
sourcemap: 'inline',
|
||||
sourcemapFile: 'bundle.js.map',
|
||||
strict: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user