-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.mjs
49 lines (43 loc) · 971 Bytes
/
loader.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
*
* Package:
* Author: Ganesh B
* Description: JS functions to check if the file is a ES Module or a CJS/ JS Module or Script
* Install: npm i check-esm --save
* Github: https://github.com/ganeshkbhat/isesm
* npmjs Link:
* File: loader.mjs
* File Description:
*
*/
/* eslint no-console: 0 */
'use strict';
globalThis.loadedURLs = [];
/**
*
*
* @export
* @param {*} specifier
* @param {*} context
* @param {*} nextResolve
* @return {*}
*/
export function resolve(specifier, context, nextResolve) {
const { parentURL = null } = context;
// Doing nothing
return nextResolve(specifier);
}
/**
*
*
* @export
* @param {*} url
* @param {*} context
* @param {*} next
* @return {*}
*/
export function load(url, context, next) {
globalThis.loadedURLs.push(url);
console.log("Url + globalThis.loadedURLs: ", url, globalThis.loadedURLs);
return next(url, context);
}