Convert require to import: rjquery, timeslider, underscore

- Convert const X = require('Y') to import X from 'Y.js'
- Convert const {A, B} = require('Y') to import {A, B} from 'Y.js'
- Add .js extensions to relative imports
- Keep external packages without .js (e.g., 'tinycon/tinycon', 'underscore')
- Convert exports.X = Y to export {X}
- Convert module.exports to export default

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
SamTV12345 2026-04-26 14:30:14 +02:00
parent fea9e5128f
commit e7bc5cdef9
3 changed files with 15 additions and 11 deletions

View file

@ -1,6 +1,8 @@
// @ts-nocheck
'use strict';
// Provides a require'able version of jQuery without leaking $ and jQuery;
window.$ = require('./vendors/jquery');
import $ from './vendors/jquery.js';
window.$ = $;
const jq = window.$.noConflict(true);
exports.jQuery = exports.$ = jq;
export {jq as jQuery, jq as $};

View file

@ -25,13 +25,13 @@
// These jQuery things should create local references, but for now `require()`
// assigns to the global `$` and augments it with plugins.
require('./vendors/jquery');
import './vendors/jquery.js';
import {randomString, Cookies} from "./pad_utils";
const hooks = require('./pluginfw/hooks');
import padutils from './pad_utils'
const socketio = require('./socketio');
import html10n from '../js/vendors/html10n'
import {randomString, Cookies} from "./pad_utils.js";
import hooks from './pluginfw/hooks.js';
import padutils from './pad_utils.js'
import socketio from './socketio.js';
import html10n from '../js/vendors/html10n.js'
let token, padId, exportLinks, socket, changesetLoader, BroadcastSlider;
let cp = '';
const playbackSpeedCookie = 'timesliderPlaybackSpeed';
@ -222,5 +222,5 @@ const handleClientVars = (message) => {
});
};
exports.baseURL = '';
exports.init = init;
export const baseURL = '';
export {init};

View file

@ -1,4 +1,6 @@
// @ts-nocheck
'use strict';
module.exports = require('underscore');
import _ from 'underscore';
export default _;