Skip to content

Commit b40baae

Browse files
authored
Merge pull request #1195 from docsifyjs/deprecate-old-globals-and-make-new-single-global
update src/core/index.js to export all global APIs, deprecate old globals…
2 parents b72cb3d + 7e002bf commit b40baae

File tree

7 files changed

+478
-216
lines changed

7 files changed

+478
-216
lines changed

Diff for: build/build.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const version = process.env.VERSION || require('../package.json').version
99
const chokidar = require('chokidar')
1010
const path = require('path')
1111

12+
/**
13+
* @param {{
14+
* input: string,
15+
* output?: string,
16+
* globalName?: string,
17+
* plugins?: Array<import('rollup').Plugin>
18+
* }} opts
19+
*/
1220
async function build(opts) {
1321
await rollup
1422
.rollup({
@@ -29,6 +37,7 @@ async function build(opts) {
2937
console.log(dest)
3038
return bundle.write({
3139
format: 'iife',
40+
output: opts.globalName ? {name: opts.globalName} : {},
3241
file: dest,
3342
strict: false
3443
})
@@ -40,13 +49,15 @@ async function buildCore() {
4049

4150
promises.push(build({
4251
input: 'src/core/index.js',
43-
output: 'docsify.js'
52+
output: 'docsify.js',
53+
globalName: 'DOCSIFY'
4454
}))
4555

4656
if (isProd) {
4757
promises.push(build({
4858
input: 'src/core/index.js',
4959
output: 'docsify.min.js',
60+
globalName: 'DOCSIFY',
5061
plugins: [uglify()]
5162
}))
5263
}

0 commit comments

Comments
 (0)