upgrade babel to 7

This commit is contained in:
Raccoon 2021-07-31 11:28:30 +08:00
parent 4dfb6e94f9
commit e0835bb73b
No known key found for this signature in database
GPG Key ID: 06770355DC9ECD38
8 changed files with 2893 additions and 796 deletions

View File

@ -1,6 +1,8 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"useBuiltIns": "entry",
"corejs": 2,
"targets": {
"node": "6",
"uglify": true
@ -8,6 +10,6 @@
}]
],
"plugins": [
"transform-runtime"
"@babel/plugin-transform-runtime"
]
}

3591
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,6 @@
"archiver": "~3.1.1",
"async": "~3.1.0",
"azure-storage": "~2.10.3",
"babel-polyfill": "~6.26.0",
"base64url": "~3.0.1",
"body-parser": "~1.19.0",
"chance": "~1.0.18",
@ -106,6 +105,10 @@
"ws": "~7.1.1"
},
"devDependencies": {
"@babel/core": "~7.14.8",
"@babel/plugin-transform-runtime": "~7.14.5",
"@babel/preset-env": "~7.14.8",
"@babel/runtime": "~7.14.8",
"@hackmd/codemirror": "~5.57.7",
"@hackmd/emojify.js": "^2.1.0",
"@hackmd/idle-js": "~1.0.1",
@ -129,14 +132,11 @@
"@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.1",
"acorn": "~6.1.1",
"babel-core": "~6.26.3",
"babel-loader": "~7.1.4",
"babel-plugin-transform-runtime": "~6.23.0",
"babel-preset-env": "~1.7.0",
"babel-runtime": "~6.26.0",
"babel-loader": "~8.2.2",
"bootstrap": "~3.4.0",
"bootstrap-validator": "~0.11.8",
"copy-webpack-plugin": "~9.0.1",
"core-js": "^2.6.12",
"css-loader": "~1.0.0",
"css-minimizer-webpack-plugin": "~3.0.2",
"dictionary-de": "^2.0.3",
@ -198,6 +198,7 @@
"power-assert": "~1.6.1",
"prismjs": "^1.17.1",
"raphael": "~2.2.8",
"regenerator-runtime": "^0.13.9",
"reveal.js": "~3.9.2",
"script-loader": "~0.7.2",
"select2": "~3.5.2-browserify",

View File

@ -81,6 +81,8 @@ import { emojifyImageDir } from './lib/editor/constants'
import modeType from './lib/modeType'
import appState from './lib/appState'
import {RevealMarkdown} from './reveal-markdown'
require('../vendor/showup/showup')
require('../css/index.css')
@ -2792,9 +2794,9 @@ function updateViewInner () {
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
}
var slides = window.RevealMarkdown.slidify(editor.getValue(), slideOptions)
var slides = RevealMarkdown.slidify(editor.getValue(), slideOptions)
ui.area.markdown.html(slides)
window.RevealMarkdown.initialize()
RevealMarkdown.initialize()
// prevent XSS
ui.area.markdown.html(preventXSS(ui.area.markdown.html()))
ui.area.markdown.addClass('slides')

View File

@ -18,6 +18,8 @@ import {
import { preventXSS } from './render'
import { RevealMarkdown } from './reveal-markdown'
require('../css/extra.css')
require('../css/slide-preview.css')
require('../css/site.css')
@ -35,9 +37,9 @@ if (md.meta.type && md.meta.type === 'slide') {
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
}
const slides = window.RevealMarkdown.slidify(text, slideOptions)
const slides = RevealMarkdown.slidify(text, slideOptions)
markdown.html(slides)
window.RevealMarkdown.initialize()
RevealMarkdown.initialize()
// prevent XSS
markdown.html(preventXSS(markdown.html()))
markdown.addClass('slides')

View File

@ -8,15 +8,7 @@ import { md } from './extra'
* markdown inside of presentations as well as loading
* of external markdown documents.
*/
(function (root, factory) {
if (typeof exports === 'object') {
module.exports = factory()
} else {
// Browser globals (root is window)
root.RevealMarkdown = factory()
root.RevealMarkdown.initialize()
}
}(this, function () {
function factory() {
var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$'
var DEFAULT_NOTES_SEPARATOR = '^note:'
var DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\.element\\s*?(.+?)$'
@ -209,10 +201,10 @@ import { md } from './extra'
})
} else {
section.outerHTML = '<section data-state="alert">' +
'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
'Check your browser\'s JavaScript console for more details.' +
'<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
'</section>'
'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
'Check your browser\'s JavaScript console for more details.' +
'<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
'</section>'
}
}
}
@ -326,11 +318,11 @@ import { md } from './extra'
var result = window.postProcess(rendered)
section.innerHTML = result[0].outerHTML
addAttributes(section, section, null, section.getAttribute('data-element-attributes') ||
section.parentNode.getAttribute('data-element-attributes') ||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
section.getAttribute('data-attributes') ||
section.parentNode.getAttribute('data-attributes') ||
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR)
section.parentNode.getAttribute('data-element-attributes') ||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
section.getAttribute('data-attributes') ||
section.parentNode.getAttribute('data-attributes') ||
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR)
// If there were notes, we need to re-add them after
// having overwritten the section's HTML
@ -352,4 +344,5 @@ import { md } from './extra'
convertSlides: convertSlides,
slidify: slidify
}
}))
}
export const RevealMarkdown = factory()

View File

@ -3,6 +3,7 @@
import { preventXSS } from './render'
import { md, updateLastChange, removeDOMEvents, finishView } from './extra'
import { RevealMarkdown } from './reveal-markdown'
require('../css/extra.css')
require('../css/site.css')

View File

@ -12,7 +12,10 @@ gracefulFs.gracefulify(fs)
module.exports = {
name: 'app',
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV', 'NODE_DEBUG']),
new webpack.DefinePlugin({
"process.env.NODE_DEBUG": process.env.NODE_ENV || 'development',
"process.env.NODE_DEBUG": "false"
}),
new webpack.ProvidePlugin({
Visibility: 'visibilityjs',
Cookies: 'js-cookie',
@ -217,7 +220,8 @@ module.exports = {
'bootstrap'
],
cover: [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
path.join(__dirname, 'public/js/cover.js')
],
'cover-styles-pack': [
@ -227,14 +231,16 @@ module.exports = {
path.join(__dirname, 'node_modules/select2/select2-bootstrap.css')
],
'cover-pack': [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'bootstrap-validator',
'expose-loader?exposes=select2!select2',
'expose-loader?exposes=moment!moment',
path.join(__dirname, 'public/js/cover.js')
],
index: [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'script-loader!jquery-ui-resizable',
'script-loader!codemirror',
'script-loader!inlineAttachment',
@ -243,7 +249,6 @@ module.exports = {
'script-loader!ot',
'flowchart.js',
'imports-loader?Raphael=raphael!js-sequence-diagrams',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
path.join(__dirname, 'public/js/index.js')
],
'index-styles': [
@ -281,7 +286,8 @@ module.exports = {
path.join(__dirname, 'node_modules/leaflet/dist/leaflet.css')
],
'index-pack': [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'script-loader!jquery-ui-resizable',
'bootstrap-validator',
'expose-loader?exposes=jsyaml!js-yaml',
@ -305,15 +311,14 @@ module.exports = {
'script-loader!vega-lite',
'script-loader!vega-embed',
'expose-loader?exposes=io!socket.io-client',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
'expose-loader?exposes=L|L|true!leaflet',
path.join(__dirname, 'public/js/index.js')
],
pretty: [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'flowchart.js',
'imports-loader?Raphael=raphael!js-sequence-diagrams',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
path.join(__dirname, 'public/js/pretty.js')
],
'pretty-styles': [
@ -328,7 +333,8 @@ module.exports = {
path.join(__dirname, 'node_modules/leaflet/dist/leaflet.css')
],
'pretty-pack': [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'expose-loader?exposes=jsyaml!js-yaml',
'script-loader!mermaid',
'expose-loader?exposes=moment!moment',
@ -344,16 +350,15 @@ module.exports = {
'script-loader!vega',
'script-loader!vega-lite',
'script-loader!vega-embed',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
'expose-loader?exposes=L|L|true!leaflet',
path.join(__dirname, 'public/js/pretty.js')
],
slide: [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'bootstrap-tooltip',
'flowchart.js',
'imports-loader?Raphael=raphael!js-sequence-diagrams',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
path.join(__dirname, 'public/js/slide.js')
],
'slide-styles': [
@ -367,7 +372,8 @@ module.exports = {
path.join(__dirname, 'node_modules/leaflet/dist/leaflet.css')
],
'slide-pack': [
'babel-polyfill',
'core-js',
'regenerator-runtime/runtime',
'expose-loader?exposes=$,jQuery!jquery',
'velocity-animate',
'imports-loader?$=jquery!jquery-mousewheel',
@ -388,7 +394,6 @@ module.exports = {
'script-loader!vega-lite',
'script-loader!vega-embed',
'expose-loader?exposes=Reveal!reveal.js',
'expose-loader?exposes=RevealMarkdown!reveal-markdown',
'expose-loader?exposes=L|L|true!leaflet',
path.join(__dirname, 'public/js/slide.js')
]