11import path from 'path'
2- import ts from 'rollup-plugin-typescript2'
2+ import typescript2 from 'rollup-plugin-typescript2'
33import replace from '@rollup/plugin-replace'
44import json from '@rollup/plugin-json'
55
@@ -10,22 +10,28 @@ if (!process.env.TARGET) {
1010const masterVersion =
1111 process . env . NEXT_VERSION || require ( './package.json' ) . version
1212const packagesDir = path . resolve ( __dirname , 'packages' )
13- const packageDir = path . resolve ( packagesDir , process . env . TARGET )
14- const name = path . basename ( packageDir )
15- const resolve = ( file ) => path . resolve ( packageDir , file )
13+ const pkgDir = path . resolve ( packagesDir , process . env . TARGET )
14+ const name = path . basename ( pkgDir )
15+ const resolve = ( file ) => path . resolve ( pkgDir , file )
1616const pkg = require ( resolve ( `package.json` ) )
1717const packageOptions = pkg . buildOptions || { }
1818
1919// ensure TS checks only once for each build
2020let hasTSChecked = false
2121
22- const banner = `/*!
22+ let banner = `/*!
2323 * ${ pkg . buildOptions . name } ${ pkg . name } v${ masterVersion }
24- * ${ pkg . homepage }
25- *
26- * Includes quill v${ pkg . dependencies . quill . match ( / \d ( .* ) / ) [ 0 ] }
24+ * ${ pkg . homepage || 'https://github.com/vueup/vue-quill' }
25+ * `
26+
27+ banner += pkg . dependencies ?. quill ?. match ( / \d ( .* ) / ) [ 0 ]
28+ ? `
29+ * Includes quill v${ pkg . dependencies ?. quill ?. match ( / \d ( .* ) / ) [ 0 ] }
2730 * https://quilljs.com/
28- *
31+ * `
32+ : ''
33+
34+ banner += `
2935 * Copyright (c) ${ new Date ( ) . getFullYear ( ) } ${ pkg . author }
3036 * Released under the ${ pkg . license } license
3137 * Date: ${ new Date ( ) . toISOString ( ) }
@@ -111,20 +117,20 @@ function createConfig(format, output, plugins = []) {
111117 const nodePlugins =
112118 format !== 'cjs'
113119 ? [
114- require ( '@rollup/plugin-node-resolve' ) . nodeResolve ( {
115- preferBuiltins : true ,
116- } ) ,
117- require ( '@rollup/plugin-commonjs' ) ( {
118- sourceMap : false ,
119- } ) ,
120- require ( 'rollup-plugin-node-builtins' ) ( ) ,
121- require ( 'rollup-plugin-node-globals' ) ( ) ,
122- ]
120+ require ( '@rollup/plugin-node-resolve' ) . nodeResolve ( {
121+ preferBuiltins : true ,
122+ } ) ,
123+ require ( '@rollup/plugin-commonjs' ) ( {
124+ sourceMap : false ,
125+ } ) ,
126+ require ( 'rollup-plugin-node-builtins' ) ( ) ,
127+ require ( 'rollup-plugin-node-globals' ) ( ) ,
128+ ]
123129 : [ ]
124130
125131 const shouldEmitDeclarations = process . env . TYPES != null && ! hasTSChecked
126132
127- const tsPlugin = ts ( {
133+ const tsPlugin = typescript2 ( {
128134 check : process . env . NODE_ENV === 'production' && ! hasTSChecked ,
129135 tsconfig : path . resolve ( __dirname , 'tsconfig.json' ) ,
130136 cacheRoot : path . resolve ( __dirname , 'node_modules/.rts2_cache' ) ,
@@ -142,7 +148,7 @@ function createConfig(format, output, plugins = []) {
142148 // during a single build.
143149 hasTSChecked = true
144150
145- const entryFile = path . resolve ( packageDir , 'src/index.ts' )
151+ const entryFile = path . resolve ( pkgDir , 'src/index.ts' )
146152
147153 return {
148154 input : resolve ( entryFile ) ,
@@ -191,9 +197,9 @@ function createReplacePlugin(
191197 __VERSION__ : `"${ masterVersion } "` ,
192198 __DEV__ : isBundlerESMBuild
193199 ? // preserve to be handled by bundlers
194- `(process.env.NODE_ENV !== 'production')`
200+ `(process.env.NODE_ENV !== 'production')`
195201 : // hard coded dev/prod builds
196- ! isProduction ,
202+ ! isProduction ,
197203 // this is only used during Vue's internal tests
198204 __TEST__ : false ,
199205 // If the build is expected to run directly in the browser (global / esm builds)
@@ -212,11 +218,11 @@ function createReplacePlugin(
212218 : false ,
213219 ...( isProduction && isBrowserBuild
214220 ? {
215- 'context.onError(' : `/*#__PURE__*/ context.onError(` ,
216- 'emitError(' : `/*#__PURE__*/ emitError(` ,
217- 'createCompilerError(' : `/*#__PURE__*/ createCompilerError(` ,
218- 'createDOMCompilerError(' : `/*#__PURE__*/ createDOMCompilerError(` ,
219- }
221+ 'context.onError(' : `/*#__PURE__*/ context.onError(` ,
222+ 'emitError(' : `/*#__PURE__*/ emitError(` ,
223+ 'createCompilerError(' : `/*#__PURE__*/ createCompilerError(` ,
224+ 'createDOMCompilerError(' : `/*#__PURE__*/ createDOMCompilerError(` ,
225+ }
220226 : { } ) ,
221227 }
222228 // allow inline overrides like
0 commit comments