-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.mjs
136 lines (112 loc) · 4.94 KB
/
demo.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
*
* Package: requireurl
* Author: Ganesh B
* Description:
* Install: npm i require-urls --save
* Github: https://github.com/ganeshkbhat/requireurl
* npmjs Link: https://www.npmjs.com/package/require-urls
* File: demos/demo.mjs
* File Description: Using requireurl instead of require to fetch files from git repositories like Github or Bitbucket like repository directly
*
*/
/* eslint no-console: 0 */
'use strict';
/**
*
* Demos are based on commit numbers or on tag numbers or version numbers
*
* A commit number variable will start with C. Example ESC8d8681c4a2 will be commit - 8d8681c4a2
* A version number based fetch example will start with V. Example ESV00_00_7 will be version - 00.00.7
* A tag commit based fetch example will start with T. Example EST0_0_7 will be tag - 0.0.7
*
* NOTE:
*
* All function implements will be based on the most recent commit of index.js.
* Any change in demos of usage of function will be based on the recent commit.
* The URLs usage will based on what was fetched.
*
*/
/**
* Commit:
* cgijs@latest
*
* @type {*}
*
*/
// // Currently Keeping this demo on hold since recursive file option not implemented
// import { default as ES_cgijs } from "https://github.com/cgi-js/cgi-js/blob/main/src/index.js";
import { default as ESC_8d8681c4a2 } from "https://raw.githubusercontent.com/ganeshkbhat/requireurl/8d8681c4a28d64f23fb473064fa86880a0b930ff/index.js";
import { default as ESV_00_00_7 } from "https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js";
import { default as EST_0_0_7 } from "https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js";
import { default as ESC_2e5181793d } from "https://github.com/ganeshkbhat/requireurl/blob/2e5181793dd8c076aafd46f3330c59e4abd70908/index.js";
const ESC_2e5181793d_2 = import("https://github.com/ganeshkbhat/requireurl/blob/2e5181793dd8c076aafd46f3330c59e4abd70908/index.js");
// let requireurls = import("../index");
// /**
// * cgijs@latest using the variable in import syntax
// * Currently Keeping this demo on hold since recursive file option not implemented
// *
// */
// // console.log("[REQUIREURLS] EScgijs: demo.mjs using import statement: ", ES_cgijs);
// /**
// * Commit:
// * C8d8681c4a2, ESC_8d8681c4a2
// *
// * @type {*}
// *
// */
// let C8d8681c4a2 = requireurls("https://raw.githubusercontent.com/ganeshkbhat/requireurl/8d8681c4a28d64f23fb473064fa86880a0b930ff/index.js");
// console.log("[C8d8681c4a2] Testing returns: ", C8d8681c4a2);
// console.log("[ESC_8d8681c4a2] Testing returns: ", ESC_8d8681c4a2);
// /**
// * Version:
// * V00_00_7, ESV_00_00_7
// *
// * @type {*}
// *
// */
// let V00_00_7 = requireurls("https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js");
// console.log("[V00_00_7] Testing returns: ", V00_00_7);
// console.log("[ESV_00_00_7] Testing returns: ", ESV_00_00_7);
// /**
// * Tag:
// * T0_0_7, EST_0_0_7
// *
// * @type {*}
// *
// */
// let T0_0_7 = requireurls("https://github.com/ganeshkbhat/requireurl/blob/a34a222d761bb70d51ff3267c8530f40918db53e/index.js");
// console.log("[T0_0_7] Testing returns: ", T0_0_7);
// console.log("[EST_0_0_7] Testing returns: ", EST_0_0_7);
// /**
// * Commit:
// * C2e5181793d, ESC_2e5181793d
// *
// * @type {*}
// *
// */
// let C2e5181793d = requireurls("https://github.com/ganeshkbhat/requireurl/blob/2e5181793dd8c076aafd46f3330c59e4abd70908/index.js");
// console.log("[C2e5181793d] Testing returns: ", C2e5181793d);
// console.log("[ESC_2e5181793d] Testing returns: ", ESC_2e5181793d);
// /**
// * Commit:
// * C2e5181793d
// *
// * @type {*}
// *
// */
// let ESCJSC_2e5181793d = import("https://github.com/ganeshkbhat/requireurl/blob/2e5181793dd8c076aafd46f3330c59e4abd70908/index.js");
// console.log("[ESCJSC_2e5181793d] Testing returns: ", ESCJSC_2e5181793d);
// /**
// * Commit:
// * Clatestcommit
// *
// * @type {*}
// *
// */
// let Clatestcommit = requireurls("https://github.com/ganeshkbhat/requireurl/blob/main/index.js", { baseType: "git", recursive: false, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatestcommit);
// let Clatest = requireurls("https://github.com/cgi-js/cgi-js/blob/main/src/index.js", { baseType: "git", recursive: true, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatest);
// let Clatest = requireurls("https://raw.githubusercontent.com/traverse-fs/fssys/main/index.js", { baseType: "git", recursive: true, forceUpdate: true, logger: console.log, cacheFetch: false, getMethods: false, noRequire: false });
// console.log("[Clatestcommit] index.js: ", Clatest);