Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 3rd party modules as esm #3251

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: remove jquery globals
chmelevskij committed Jan 23, 2023
commit 0431650d074a33af1300573fbad38f6960bb186c
7 changes: 6 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -392,6 +392,7 @@ function dist_rollup() {
const alias = require('@rollup/plugin-alias');
const vue = require('rollup-plugin-vue');
const rollupReplace = require('@rollup/plugin-replace');
const inject = require('@rollup/plugin-inject');

return rollup
.rollup({
@@ -402,10 +403,14 @@ function dist_rollup() {
// it with `import/export` file doesn't have to be here.
// I will be picked up by rollup and bundled accordingly.
'js/main_cordova': 'src/js/main_cordova.js',
'js/utils/common': 'src/js/utils/common.js',
// 'js/utils/common': 'src/js/utils/common.js',
'js/main': 'src/js/main.js',
},
plugins: [
inject({
$: 'jquery',
jQuery: 'jquery',
}),
alias({
entries: {
vue: require.resolve('vue/dist/vue.esm.js'),
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.0",
"@panter/vue-i18next": "^0.15.2",
"@rollup/plugin-inject": "^5.0.3",
"bonjour": "^3.5.0",
"crypto-es": "^1.2.7",
"d3": "^7.8.1",
@@ -65,7 +66,7 @@
"jquery": "^3.6.1",
"jquery-textcomplete": "^1.8.5",
"jquery-touchswipe": "^1.6.19",
"jquery-ui-npm": "^1.12.0",
"jquery-ui": "^1.12.0",
"jsdom": "^21.0.0",
"marked": "^4.1.1",
"multicast-dns": "^7.2.5",
6 changes: 0 additions & 6 deletions src/js/jQuery.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/js/jQueryPlugins.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'jquery-ui-npm';
import '../../libraries/jquery.nouislider.all.min.js';
import '../../libraries/jquery.flightindicators.js';
import '../../libraries/jquery.ba-throttle-debounce.min.js';
import 'jquery-ui';
import 'jquery-textcomplete';
import 'jquery-touchswipe';
import 'select2';
import 'multiple-select';
import '../../libraries/jquery.nouislider.all.min.js';
import '../../libraries/jquery.flightindicators.js';
import '../../libraries/jquery.ba-throttle-debounce.min.js';
4 changes: 3 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import $ from 'jquery';
import 'jbox';
import $ from './jQuery';
// TODO: this is needed for some of the tabs, might make more sense to import things there.
import './jQueryPlugins';
import * as THREE from 'three';
import '../components/init.js';
import { gui_log } from './gui_log.js';
import * as d3 from 'd3';
// same, msp seems to be everywhere used from global scope
import './msp/MSPHelper.js';
import { i18n } from './localization.js';
1 change: 1 addition & 0 deletions src/js/utils/common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import semver from "semver";
import { mixerList } from "../model";
import CONFIGURATOR from "../data_storage";
import $ from "jquery";

export function millitime() {
return new Date().getTime();
6 changes: 0 additions & 6 deletions src/tabs/receiver_msp.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<html>
<head>
<link type="text/css" rel="stylesheet" href="/css/opensans_webfontkit/fonts.css" media="all" />
<script type="text/javascript" src="/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/node_modules/jquery-ui-npm/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/libraries/jquery.nouislider.all.min.js"></script>

<script type="text/javascript" src="/js/utils/window_watchers.js"></script>
<script type="text/javascript" src="/js/tabs/receiver_msp.js"></script>

<link type="text/css" rel="stylesheet" href="/js/libraries/jquery.nouislider.min.css">
<link type="text/css" rel="stylesheet" href="/js/libraries/jquery.nouislider.pips.min.css">
24 changes: 20 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1830,6 +1830,15 @@
is-reference "1.2.1"
magic-string "^0.27.0"

"@rollup/plugin-inject@^5.0.3":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.3.tgz#0783711efd93a9547d52971db73b2fb6140a67b1"
integrity sha512-411QlbL+z2yXpRWFXSmw/teQRMkXcAAC8aYTemc15gwJRpvEVDQwoe+N/HTFD8RFG8+88Bme9DK2V9CVm7hJdA==
dependencies:
"@rollup/pluginutils" "^5.0.1"
estree-walker "^2.0.2"
magic-string "^0.27.0"

"@rollup/plugin-node-resolve@^15.0.1":
version "15.0.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz#72be449b8e06f6367168d5b3cd5e2802e0248971"
@@ -9761,10 +9770,17 @@ jquery-touchswipe@^1.6.19:
resolved "https://registry.yarnpkg.com/jquery-touchswipe/-/jquery-touchswipe-1.6.19.tgz#dfd5ddaec0b78212dd500d29707129b9c7fd6cd4"
integrity sha512-b0BGje9reNRU3u6ksAK9QqnX7yBRgLNe/wYG7DOfyDlhBlYjayIT8bSOHmcuvptIDW/ubM9CTW/mnZf9Rohuow==

jquery-ui-npm@^1.12.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/jquery-ui-npm/-/jquery-ui-npm-1.12.0.tgz#3f2cae88195c7d48acf3786cfa900d0403814e4d"
integrity sha1-PyyuiBlcfUis83hs+pANBAOBTk0=
jquery-ui@^1.12.0:
version "1.13.2"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.13.2.tgz#de03580ae6604773602f8d786ad1abfb75232034"
integrity sha512-wBZPnqWs5GaYJmo1Jj0k/mrSkzdQzKDwhXNtHKcBdAcKVxMM3KNYFq+iJ2i1rwiG53Z8M4mTn3Qxrm17uH1D4Q==
dependencies:
jquery ">=1.8.0 <4.0.0"

"jquery@>=1.8.0 <4.0.0":
version "3.6.3"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.3.tgz#23ed2ffed8a19e048814f13391a19afcdba160e6"
integrity sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg==

jquery@^3.6.0:
version "3.6.0"