1
1
import path from 'path'
2
- import ts from 'rollup-plugin-typescript2'
2
+ import typescript2 from 'rollup-plugin-typescript2'
3
3
import replace from '@rollup/plugin-replace'
4
4
import json from '@rollup/plugin-json'
5
5
@@ -10,22 +10,28 @@ if (!process.env.TARGET) {
10
10
const masterVersion =
11
11
process . env . NEXT_VERSION || require ( './package.json' ) . version
12
12
const 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 )
16
16
const pkg = require ( resolve ( `package.json` ) )
17
17
const packageOptions = pkg . buildOptions || { }
18
18
19
19
// ensure TS checks only once for each build
20
20
let hasTSChecked = false
21
21
22
- const banner = `/*!
22
+ let banner = `/*!
23
23
* ${ 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 ] }
27
30
* https://quilljs.com/
28
- *
31
+ * `
32
+ : ''
33
+
34
+ banner += `
29
35
* Copyright (c) ${ new Date ( ) . getFullYear ( ) } ${ pkg . author }
30
36
* Released under the ${ pkg . license } license
31
37
* Date: ${ new Date ( ) . toISOString ( ) }
@@ -111,20 +117,20 @@ function createConfig(format, output, plugins = []) {
111
117
const nodePlugins =
112
118
format !== 'cjs'
113
119
? [
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
+ ]
123
129
: [ ]
124
130
125
131
const shouldEmitDeclarations = process . env . TYPES != null && ! hasTSChecked
126
132
127
- const tsPlugin = ts ( {
133
+ const tsPlugin = typescript2 ( {
128
134
check : process . env . NODE_ENV === 'production' && ! hasTSChecked ,
129
135
tsconfig : path . resolve ( __dirname , 'tsconfig.json' ) ,
130
136
cacheRoot : path . resolve ( __dirname , 'node_modules/.rts2_cache' ) ,
@@ -142,7 +148,7 @@ function createConfig(format, output, plugins = []) {
142
148
// during a single build.
143
149
hasTSChecked = true
144
150
145
- const entryFile = path . resolve ( packageDir , 'src/index.ts' )
151
+ const entryFile = path . resolve ( pkgDir , 'src/index.ts' )
146
152
147
153
return {
148
154
input : resolve ( entryFile ) ,
@@ -191,9 +197,9 @@ function createReplacePlugin(
191
197
__VERSION__ : `"${ masterVersion } "` ,
192
198
__DEV__ : isBundlerESMBuild
193
199
? // preserve to be handled by bundlers
194
- `(process.env.NODE_ENV !== 'production')`
200
+ `(process.env.NODE_ENV !== 'production')`
195
201
: // hard coded dev/prod builds
196
- ! isProduction ,
202
+ ! isProduction ,
197
203
// this is only used during Vue's internal tests
198
204
__TEST__ : false ,
199
205
// If the build is expected to run directly in the browser (global / esm builds)
@@ -212,11 +218,11 @@ function createReplacePlugin(
212
218
: false ,
213
219
...( isProduction && isBrowserBuild
214
220
? {
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
+ }
220
226
: { } ) ,
221
227
}
222
228
// allow inline overrides like
0 commit comments