From a3434c789772a29472426f465cca3d06280eb1e2 Mon Sep 17 00:00:00 2001 From: 0xpapercut <0xpapercut@gmail.com> Date: Sun, 14 Apr 2024 20:41:24 +0200 Subject: [PATCH] Add utils.js and remove katex flow type stripping --- src/katex/webpack.config.js | 24 ------------------------ src/katex/katex.js => utils.js | 0 wypst.js | 8 ++++---- 3 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 src/katex/webpack.config.js rename src/katex/katex.js => utils.js (100%) diff --git a/src/katex/webpack.config.js b/src/katex/webpack.config.js deleted file mode 100644 index 8cd4aa5..0000000 --- a/src/katex/webpack.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - entry: './katex.js', - output: { - path: __dirname + '/../..', - filename: 'katex.js', - library: 'katex', - libraryTarget: 'umd', - }, - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules\/(?!katex)/, - use: { - loader: 'babel-loader', - options: { - presets: ['@babel/preset-flow'], - }, - }, - } - ] - }, - mode: 'production' -}; diff --git a/src/katex/katex.js b/utils.js similarity index 100% rename from src/katex/katex.js rename to utils.js diff --git a/wypst.js b/wypst.js index d09aea2..e9e9384 100644 --- a/wypst.js +++ b/wypst.js @@ -1,5 +1,5 @@ import init, { parseTree as _parseTree, typstContentTree } from './core'; -import katex from './katex'; +import utils from './utils'; function parseTree(expression, settings) { expression = expression.trim().replace(/\n/g, ' '); @@ -7,13 +7,13 @@ function parseTree(expression, settings) { } function renderToDomTree(expression, options) { - let settings = new katex.Settings(options); + let settings = new utils.Settings(options); try { const tree = parseTree(expression, settings); - return katex.buildTree(tree, expression, settings); + return utils.buildTree(tree, expression, settings); } catch (error) { // Temporary fix so that we actually see errors like "unknown variable: ..." - return katex.renderError(error, error, settings); + return utils.renderError(error, error, settings); } }