Skip to content

Commit

Permalink
+ library_namespace.env.force_including_compatibility_module
Browse files Browse the repository at this point in the history
  • Loading branch information
kanasimi committed Sep 22, 2022
1 parent 6fbcf12 commit 202a8af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
16 changes: 9 additions & 7 deletions _build/combined/build.combined.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ https://kinsta.com/blog/minify-javascript/
const default_language = 'en';

globalThis.CeL = {
env: { default_domain: default_language }
env: {
default_domain: default_language,
// at least on older Chrome Browser additional dependancies failed to load
// https://github.com/kanasimi/CeJS/issues/37#issuecomment-1254476627
// Forced loading of compatibility modules. 強制載入相容性模組。
force_including_compatibility_module: true,
}
};

require('./_CeL.loader.nodejs.js');
Expand All @@ -32,11 +38,7 @@ require('./_CeL.loader.nodejs.js');
const profiles = {
CeJS_wiki: {
combined_script_file_path: 'CeJS_wiki/CeJS_wiki.js',
exclude_modules: new Set(['application.platform.nodejs',
// at least on older Chrome Browser additional dependancies failed to load
// https://github.com/kanasimi/CeJS/issues/37#issuecomment-1254476627
//'data.code.compatibility',
'application/locale/resources/cmn-Hant-TW.js']),
exclude_modules: new Set(['application.platform.nodejs', 'application/locale/resources/cmn-Hant-TW.js']),
// 載入操作維基百科的主要功能。
include_modules: [['application.net.wiki',], () => {
CeL.gettext.load_domain(default_language, true);
Expand Down Expand Up @@ -71,7 +73,7 @@ function build_standalone_version() {
/*
本檔案為自動生成,請勿手動編輯!
The main script file: ${profile.combined_script_file_path}
is auto created by auto-generate tool: ${library_build_script_name}(.js) @ ${new Date}.
is auto created by auto-generate tool: ${library_build_script_name}(.js) @ ${(new Date).toISOString()}.
*/
`, CeL.get_file(CeL.get_module_path()));

Expand Down
11 changes: 7 additions & 4 deletions _structure/dependency_chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -4044,8 +4044,14 @@ if (typeof CeL === 'function')
// export.
library_namespace.get_module_path = get_module_path;

// Forced loading of compatibility modules. 強制載入相容性模組。
if (!library_namespace.env.force_including_compatibility_module
// check from newer to older
if (has_native_Set
// node 4 does not has Array.prototype.includes()
// node 16 does not has Array.prototype.at()
&& Array.prototype.at
//
&& has_native_Set
// node 10.19.0 does not has `globalThis`
&& typeof globalThis !== 'undefined' && globalThis
//
Expand All @@ -4058,9 +4064,6 @@ if (typeof CeL === 'function')
&& String.prototype.trimEnd && String.prototype.padEnd
// node 6.2.2 does not has Object.values(), Object.entries()
&& Object.entries
// node 4 does not has Array.prototype.includes()
// node 16 does not has Array.prototype.at()
&& Array.prototype.at
// Chrome/73.0.3683.20, Firefox/67.0 has .matchAll(),
// node 11.9 DO NOT has .matchAll().
&& String.prototype.matchAll) {
Expand Down
Binary file modified ce.js
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cejs",
"title": "CeJS",
"version": "4.5.4",
"version": "4.5.5",
"description": "A JavaScript module framework that is simple to use.",
"keywords": [
"arbitrary-precision",
Expand Down

0 comments on commit 202a8af

Please sign in to comment.