mirror of
https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
synced 2025-09-28 00:55:02 +02:00
permet l'ajout des frameworks et des routes
This commit is contained in:
151
app/node_modules/cejs/_for include/_CeL.loader.nodejs.js
generated
vendored
Normal file
151
app/node_modules/cejs/_for include/_CeL.loader.nodejs.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @name framework loader for node.js.
|
||||
*
|
||||
* @fileoverview Example to include CeL (CeJS) in node.js. node.js 下之 CeL
|
||||
* 簡易加載器。本檔僅包括含入並運用 node.loader.js 的最精簡程式碼。<br />
|
||||
* Copy from:
|
||||
* https://github.com/kanasimi/CeJS/blob/master/_for%20include/_CeL.loader.nodejs.js
|
||||
*
|
||||
* usage: See ../README.md
|
||||
*/
|
||||
|
||||
typeof CeL !== 'function' && (function() {
|
||||
"use strict";
|
||||
|
||||
var full_root =
|
||||
// require('electron').app.getPath('userData')
|
||||
module.filename
|
||||
// TODO:
|
||||
// https://www.electronjs.org/docs/latest/api/app#appgetpathname
|
||||
// https://stackoverflow.com/questions/71365401/how-to-read-config-file-in-electronjs-app
|
||||
&& module.filename.replace(/[^\\\/]+$/, ''),
|
||||
// WARNING: repository_path_list_file should be an absolute path in some
|
||||
// environment.
|
||||
repository_path_list_file
|
||||
//
|
||||
= (full_root || './') + '_repository_path_list.txt',
|
||||
//
|
||||
matched = full_root.match(/^(.+?[\\\/])_for include[\\\/]$/),
|
||||
//
|
||||
node_fs = require('fs'),
|
||||
//
|
||||
CeL_path_list = node_fs.readFileSync(repository_path_list_file);
|
||||
CeL_path_list = CeL_path_list && CeL_path_list.toString() || '';
|
||||
|
||||
if (matched) {
|
||||
// `CeL_path_list` should not be "" here,
|
||||
// but it doesn’t matter.
|
||||
|
||||
// 直接 require 函式庫下面的本檔案。 e.g.,
|
||||
// require('path\\JS\\_for include\\_CeL.loader.nodejs.js');
|
||||
// 如此可以不依靠 repository_path_list_file。
|
||||
// ** 這時應該採用: require('path/to/node.loader.js');
|
||||
CeL_path_list += '\n' + matched[1];
|
||||
}
|
||||
|
||||
if (!CeL_path_list) {
|
||||
console.error(
|
||||
//
|
||||
'Please set the absolute path list of CeL library in the file ['
|
||||
//
|
||||
+ repository_path_list_file + ']!');
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load CeJS library. For node.js loading.
|
||||
// Copy/modified from "/_for include/_CeL.loader.nodejs.js".
|
||||
|
||||
function check_path(path) {
|
||||
path = path.trim();
|
||||
if (!path || path.charAt(0) === '#') {
|
||||
// path is comments or blank line
|
||||
return;
|
||||
}
|
||||
// console.log('Try path: ' + JSON.stringify(path));
|
||||
try {
|
||||
// old node.js has no method 'accessSync'.
|
||||
// accessSync() added in: v0.11.15
|
||||
if (node_fs.accessSync) {
|
||||
// accessSync() throws if any accessibility checks fail,
|
||||
// and does nothing otherwise.
|
||||
node_fs.accessSync(path);
|
||||
} else if (!node_fs.existsSync(path)) {
|
||||
throw 'ENOENT';
|
||||
}
|
||||
|
||||
if (!/[^\\\/]$/.test(path)) {
|
||||
path += require('path').sep;
|
||||
}
|
||||
if (typeof global.CeL !== 'function'
|
||||
//
|
||||
&& (typeof global.CeL !== 'object' || !CeL)) {
|
||||
global.CeL = {};
|
||||
}
|
||||
CeL.library_path = path + 'ce.js';
|
||||
|
||||
var loader = '/_for include/node.loader.js';
|
||||
loader = path + (path.indexOf('/') !== -1 ? loader
|
||||
//
|
||||
: loader.replace(/\//g, '\\'));
|
||||
// console.log('Try loader path: ' + loader);
|
||||
require(loader);
|
||||
return CeL.version;
|
||||
} catch (e) {
|
||||
// console.error(e);
|
||||
// try next path
|
||||
}
|
||||
|
||||
// Try the file below loader for relative path.
|
||||
if (full_root && !/^(?:\/|[A-Z]:\\)/i.test(path)) {
|
||||
return check_path(full_root + path);
|
||||
}
|
||||
}
|
||||
|
||||
CeL_path_list.split(CeL_path_list.indexOf('\n') === -1 ? '|' : /\r?\n/)
|
||||
// 載入CeJS基礎泛用之功能。(例如非特殊目的使用的載入功能)
|
||||
.some(check_path);
|
||||
|
||||
// If no latest version found, try to use cejs module instead.
|
||||
if (typeof use_cejs_mudule === 'boolean'
|
||||
// Set "global.use_cejs_mudule = true;" if you need to do so anyway.
|
||||
&& use_cejs_mudule && typeof CeL !== 'function') {
|
||||
try {
|
||||
// 若有 CeJS 則用之。
|
||||
require('cejs');
|
||||
console.log('cejs loader: use npm, not the latest version!');
|
||||
return;
|
||||
|
||||
} catch (e) {
|
||||
// console.error(e);
|
||||
}
|
||||
|
||||
console.error('Failed to load CeJS library!\n');
|
||||
console.info('Please install CeJS library first.'
|
||||
//
|
||||
+ ' 請先安裝 CeJS library:\n' + 'npm install cejs\n\n'
|
||||
//
|
||||
+ 'Or you may trying the latest version:\n'
|
||||
//
|
||||
+ 'See https://github.com/kanasimi/CeJS');
|
||||
throw 'No CeJS library';
|
||||
}
|
||||
|
||||
if (typeof CeL !== 'function') {
|
||||
console.error('Failed to load CeL!');
|
||||
console.error('current working directory: ' + process.cwd());
|
||||
console.error('main script: '
|
||||
//
|
||||
+ (require.main && require.main.filename));
|
||||
console.error('loader path: ' + module.filename);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load module.
|
||||
|
||||
// CeL.env.no_catch = true;
|
||||
// CeL.set_debug(2);
|
||||
|
||||
// CeL.run([ 'data.code.compatibility' ]);
|
72
app/node_modules/cejs/_for include/jslibs.loader.js
generated
vendored
Normal file
72
app/node_modules/cejs/_for include/jslibs.loader.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @name framework loader for jslibs.
|
||||
* @example for including:<br />
|
||||
* <code>
|
||||
* LoadModule('jsio');
|
||||
*
|
||||
* eval(new File("path/to/jslibs.loader.js").Open('r').Read().replace(/\/\*.*?\*\//g, ''));
|
||||
* </code>
|
||||
* @since 2011/11/27 17:00:08
|
||||
* @see http://code.google.com/p/jslibs/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
try {
|
||||
|
||||
if (typeof CeL !== 'function' && (typeof CeL !== 'object' || !CeL))
|
||||
Function('return this')().CeL = {};
|
||||
|
||||
// main lib path relative to the loader script.
|
||||
CeL.library_path = '../ce.js';
|
||||
|
||||
if (!CeL.loader_script)
|
||||
CeL.loader_script = arguments[0], CeL.loader_arguments = arguments;
|
||||
|
||||
(function() {
|
||||
|
||||
LoadModule('jsio');
|
||||
|
||||
var script_code = [], main_lib_binary = new File(/^[\\\/]/
|
||||
.test(CeL.library_path) ? CeL.library_path : CeL.loader_script
|
||||
.replace(/[^\\\/]+$/, CeL.library_path)).Open('r').Read();
|
||||
|
||||
// .charCodeAt() @ jslibs: -128~127
|
||||
|
||||
// _configuration.stdout( main_lib_binary.length );
|
||||
|
||||
// a simplified .get_file() for UTF-32.
|
||||
var c1, c2, i = 2, l = main_lib_binary.length;
|
||||
for (; i < l;) {
|
||||
c1 = main_lib_binary.charCodeAt(i++);
|
||||
if (c1 < 0)
|
||||
c1 += 256;
|
||||
c2 = main_lib_binary.charCodeAt(i++);
|
||||
if (c2 < 0)
|
||||
c2 += 256;
|
||||
script_code.push(String.fromCharCode(c1 + 256 * c2));
|
||||
}
|
||||
|
||||
CeL.library_code = script_code.join('');
|
||||
// _configuration.stdout(script_code.slice(0,300));
|
||||
|
||||
})();
|
||||
|
||||
eval(CeL.library_code);
|
||||
// _configuration.stdout('CeL: ' + typeof CeL);
|
||||
// _configuration.stdout(CeL.set_debug);
|
||||
|
||||
delete CeL.get_old_namespace().script_code;
|
||||
|
||||
} catch (e) {
|
||||
_configuration.stderr(e);
|
||||
}
|
||||
|
||||
if (false && typeof CeL === 'function') {
|
||||
CeL.set_debug();
|
||||
|
||||
CeL.run('data.math', function() {
|
||||
var n1 = 123, n2 = 234;
|
||||
CeL.log('GCD(' + n1 + ', ' + n2 + ') = ' + CeL.GCD(n1, n2));
|
||||
});
|
||||
}
|
117
app/node_modules/cejs/_for include/node.loader.js
generated
vendored
Normal file
117
app/node_modules/cejs/_for include/node.loader.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @name framework loader for node.js.
|
||||
*
|
||||
* See _CeL.loader.nodejs.js for a example that is simple to use.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* for including: <code>
|
||||
|
||||
require("./path/to/node.loader.js");
|
||||
|
||||
</code>
|
||||
*
|
||||
* @since 2011/11/26 23:33:32
|
||||
* @see http://nodejs.org/
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// ---------------------------------------------------------------------//
|
||||
|
||||
// console.trace(global.CeL);
|
||||
|
||||
try {
|
||||
// http://nodejs.org/api/globals.html
|
||||
// node.js requires this method to setup REALLY global various:
|
||||
// require isn't actually a global but rather local to each module.
|
||||
if (typeof CeL !== 'function' && (typeof CeL !== 'object' || !CeL))
|
||||
Function('return this')().CeL = {};
|
||||
// main lib path relative to the loader script.
|
||||
CeL.library_path = '../ce.js';
|
||||
if (false && !globalThis.require && typeof require === 'funtion')
|
||||
globalThis.require = require;
|
||||
|
||||
(function() {
|
||||
// 若非 absolute path,則將之改為 absolute path,
|
||||
// 否則 setup_library_base_path() 會抓不到。
|
||||
if (!/^([A-Z]:)?[\\\/]/i.test(CeL.library_path)
|
||||
// @snowpack: 例如 __filename ===
|
||||
// /pwikiapi-test-main\node_moduleswikiapi\node_modulescejs_for include
|
||||
// && /\.js/.test(__filename)
|
||||
) {
|
||||
// 這裡 __filename 是 loader 本身之 path。
|
||||
CeL.library_path = __filename
|
||||
.replace(/[^\\\/]+$/, CeL.library_path);
|
||||
}
|
||||
|
||||
var script_code = [], fs = require('fs'),
|
||||
// http://nodejs.org/api/fs.html#fs.readFileSync
|
||||
main_lib_binary = fs.readFileSync(CeL.library_path
|
||||
// The encoding can be 'utf8', 'ascii', or 'base64'.
|
||||
// http://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options
|
||||
// , 'utf8'
|
||||
),
|
||||
// pass the first 2 bytes (BOM)
|
||||
i = 2, l =
|
||||
// 10
|
||||
main_lib_binary.length;
|
||||
|
||||
if (false)
|
||||
console.log([ CeL.library_path, typeof main_lib_binary.length,
|
||||
main_lib_binary.length ]);
|
||||
|
||||
// a simplified .get_file() for UTF-32.
|
||||
for (; i < l;) {
|
||||
// console.log(main_lib_binary[i] + ',' + main_lib_binary[i + 1]);
|
||||
script_code.push(String.fromCharCode(main_lib_binary[i++] + 256
|
||||
* main_lib_binary[i++]));
|
||||
}
|
||||
|
||||
CeL.library_code = script_code.join('');
|
||||
|
||||
if (false) {
|
||||
console.log(script_code.length);
|
||||
// console.log(script_code.slice(0, 30));
|
||||
console.log('[' + script_code.slice(0, 300)
|
||||
// .replace(/[\x00-\x1f]/g, '.')
|
||||
.replace(/[\u0100-\uffff]/g, '.')
|
||||
// .charCodeAt(0)
|
||||
+ ']');
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
eval(CeL.library_code);
|
||||
if (false) {
|
||||
console.log('CeL === globalThis.CeL: ' + (CeL === globalThis.CeL));
|
||||
console.log('typeof CeL: ' + typeof CeL);
|
||||
console.log('CeL: ' + CeL);
|
||||
console.log('CeL.set_debug: ' + CeL.set_debug);
|
||||
}
|
||||
|
||||
// delete cache.
|
||||
delete CeL.get_old_namespace().script_code;
|
||||
|
||||
// for npm
|
||||
module.exports = CeL;
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
// CeL.run('application.platform.nodejs', 'data.CSV');
|
||||
|
||||
if (false && typeof CeL === 'function') {
|
||||
CeL.set_debug();
|
||||
|
||||
if (false)
|
||||
console.log(CeL.get_file('data.js').slice(0, 300).replace(
|
||||
/[\u0100-\uffff]/g, '.'));
|
||||
|
||||
CeL.run('data.math', function() {
|
||||
var n1 = 123, n2 = 234;
|
||||
CeL.log('GCD(' + n1 + ', ' + n2 + ') = ' + CeL.GCD(n1, n2));
|
||||
});
|
||||
}
|
111
app/node_modules/cejs/_for include/qjs.loader.js
generated
vendored
Normal file
111
app/node_modules/cejs/_for include/qjs.loader.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* @name framework loader for QuickJS.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* for including: <code>
|
||||
|
||||
|
||||
</code>
|
||||
*
|
||||
* @since
|
||||
* @see https://bellard.org/quickjs/
|
||||
* @see https://github.com/mengmo/QuickJS-Windows-Build
|
||||
*/
|
||||
|
||||
// import statement must place at the beginning of the script.
|
||||
import * as std from 'std';
|
||||
import * as os from 'os';
|
||||
|
||||
'use strict';
|
||||
|
||||
// ---------------------------------------------------------------------//
|
||||
|
||||
if (typeof CeL !== 'function' && (typeof CeL !== 'object' || !CeL))
|
||||
Function('return this')().CeL = {};
|
||||
// main lib path relative to the loader script.
|
||||
CeL.library_path = '../ce.js';
|
||||
|
||||
(function() {
|
||||
// 若非 absolute path,則將之改為 absolute path,
|
||||
// 否則 setup_library_base_path() 會抓不到。
|
||||
if (!/^([A-Z]:)?[\\\/]/i.test(CeL.library_path))
|
||||
// 這裡 os.getcwd()[0] 是 loader 本身之 path。
|
||||
CeL.library_path = os.getcwd()[0].replace(/[^\\\/]+$/, CeL.library_path
|
||||
.replace(/^..\//, ''));
|
||||
// CeL.library_path = os.realpath(CeL.library_path)[0];
|
||||
// console.log(CeL.library_path);
|
||||
|
||||
var main_script_file = std.open(CeL.library_path, 'r');
|
||||
main_script_file.seek(0, std.SEEK_END);
|
||||
var main_script_file_size = main_script_file.tell();
|
||||
// console.log(main_script_file_size);
|
||||
|
||||
var script_code = [],
|
||||
// http://nodejs.org/api/fs.html#fs.readFileSync
|
||||
main_lib_binary_buffer = new ArrayBuffer(main_script_file_size);
|
||||
main_script_file.seek(0, std.SEEK_SET);
|
||||
// console.log(main_script_file.tell());
|
||||
main_script_file.read(main_lib_binary_buffer, 0, main_script_file_size);
|
||||
// console.log(main_script_file.tell());
|
||||
|
||||
var main_lib_binary = new Uint8Array(main_lib_binary_buffer);
|
||||
// console.log(main_lib_binary.slice(0,30));
|
||||
// pass the first 2 bytes (BOM)
|
||||
var i = 2, l =
|
||||
// 10
|
||||
main_script_file_size;
|
||||
// console.log(main_lib_binary.slice(0,800));
|
||||
|
||||
if (false)
|
||||
console.log([ CeL.library_path, typeof main_lib_binary.length,
|
||||
main_lib_binary.length ]);
|
||||
|
||||
// a simplified .get_file() for UTF-32.
|
||||
for (; i < l;) {
|
||||
var char_code = main_lib_binary[i++] + 256 * main_lib_binary[i++];
|
||||
// console.log(main_lib_binary[i] + ',' + main_lib_binary[i + 1]);
|
||||
script_code.push(String.fromCharCode(char_code));
|
||||
}
|
||||
|
||||
CeL.library_code = script_code.join('');
|
||||
|
||||
if (false) {
|
||||
console.log(script_code.length);
|
||||
// console.log(script_code.slice(0, 30));
|
||||
// console.log(CeL.library_code.slice(0, 30));
|
||||
console.log('[' + CeL.library_code.slice(0, 300)
|
||||
// .replace(/[\x00-\x1f]/g, '.')
|
||||
.replace(/[\u0100-\uffff]/g, '.')
|
||||
// .charCodeAt(0)
|
||||
+ ']');
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
// 2020/5/1 18:38:19 failed
|
||||
std.evalScript(CeL.library_code);
|
||||
if (false || 1) {
|
||||
console.log('CeL === globalThis.CeL: ' + (CeL === globalThis.CeL));
|
||||
console.log('typeof CeL: ' + typeof CeL);
|
||||
console.log('CeL: ' + CeL);
|
||||
console.log('CeL.set_debug: ' + CeL.set_debug);
|
||||
}
|
||||
|
||||
// delete cache.
|
||||
delete CeL.get_old_namespace().script_code;
|
||||
|
||||
// CeL.run('application.platform.nodejs', 'data.CSV');
|
||||
|
||||
if (false && typeof CeL === 'function') {
|
||||
CeL.set_debug();
|
||||
|
||||
if (false)
|
||||
console.log(CeL.get_file('data.js').slice(0, 300).replace(
|
||||
/[\u0100-\uffff]/g, '.'));
|
||||
|
||||
CeL.run('data.math', function() {
|
||||
var n1 = 123, n2 = 234;
|
||||
CeL.log('GCD(' + n1 + ', ' + n2 + ') = ' + CeL.GCD(n1, n2));
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user