mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03469edf3e | |||
| d89191b7f7 | |||
| dd9d712702 | |||
| f030465e50 | |||
| 6fb4461231 | |||
| f20a9ec080 | |||
| d1461bfe54 | |||
| f274e26e91 | |||
| 9b75d8bb72 | |||
| edeb211247 | |||
| ddb702ae05 | |||
| 183ffdafd8 | |||
| 26820d4891 | |||
| 776fd890ba | |||
| b1c480286c | |||
| 258d7c474b | |||
| b094d7f3e1 | |||
| 50a5ce3dce | |||
| 941f336ac8 | |||
| 827b51045b | |||
| 1b4158af2d | |||
| a7d6fbdc8b | |||
| 7a2d2f2826 | |||
| 707cb414a2 | |||
| c722008b17 | |||
| f4b9b9e3ae | |||
| ff7878b68a | |||
| 4e02df8629 | |||
| ef19a065c5 | |||
| 18854de6fd | |||
| 6fc39e9ef5 | |||
| a4d3015367 | |||
| eafe5da311 | |||
| f074503266 | |||
| 1e082792bb | |||
| 7c3b717542 | |||
| 12fba4f2ca |
@@ -111,7 +111,9 @@ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
|
||||
'theme' => [
|
||||
'name'=>$ci->config->item('theme_name'),
|
||||
'modes'=>$ci->config->item('theme_modes'),
|
||||
]
|
||||
],
|
||||
'fhcomplete_build_version' => $ci->config->item('fhcomplete_build_version'),
|
||||
'use_fhcomplete_build_version_in_path' => $ci->config->item('use_fhcomplete_build_version_in_path'),
|
||||
);
|
||||
|
||||
$toPrint = "\n";
|
||||
@@ -178,6 +180,8 @@ function generateJSModulesInclude($JSModules)
|
||||
|
||||
$ci =& get_instance();
|
||||
$cachetoken = '?'.$ci->config->item('fhcomplete_build_version');
|
||||
$ci->load->config('javascript');
|
||||
$use_bundled_javascript = $ci->config->item('use_bundled_javascript');
|
||||
|
||||
if (isset($JSModules))
|
||||
{
|
||||
@@ -185,14 +189,20 @@ function generateJSModulesInclude($JSModules)
|
||||
|
||||
for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++)
|
||||
{
|
||||
$item = $tmpJSs[$tmpJSsCounter];
|
||||
if($use_bundled_javascript && preg_match('#/js/apps/#', $item))
|
||||
{
|
||||
$item = preg_replace('#^public/#', 'public/dist/', $item);
|
||||
}
|
||||
echo "<!--{$item}-->".PHP_EOL;
|
||||
if($ci->config->item('use_fhcomplete_build_version_in_path'))
|
||||
{
|
||||
$relurl = preg_replace('#public/#', 'public/' . $ci->config->item('fhcomplete_build_version') . '/', $tmpJSs[$tmpJSsCounter]);
|
||||
$relurl = preg_replace('#public/#', 'public/' . $ci->config->item('fhcomplete_build_version') . '/', $item);
|
||||
$toPrint = sprintf($jsInclude, base_url($relurl)).PHP_EOL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter].$cachetoken)).PHP_EOL;
|
||||
$toPrint = sprintf($jsInclude, base_url($item.$cachetoken)).PHP_EOL;
|
||||
}
|
||||
|
||||
if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ExtensionsLib
|
||||
// Directories that are part of the extension archive
|
||||
private $SOFTLINK_TARGET_DIRECTORIES = array(
|
||||
APPPATH => array('config', 'components', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'),
|
||||
DOC_ROOT => array('public')
|
||||
DOC_ROOT => array('public', 'public/dist')
|
||||
);
|
||||
|
||||
private $_errorOccurred; // boolean, true if an error occurred while installing an extension
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "fhc-core",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"watch": "rollup --watch -c"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"glob": "^13.0.6",
|
||||
"node-sass": "^9.0.0",
|
||||
"rollup": "^4.52.4",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-vue": "^6.0.0"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
@@ -0,0 +1,2 @@
|
||||
const e="error",t="retval",r={get:function(e,t,n=null){return r._axiosCall(e,t,"get",n)},post:function(e,t,n=null){return r._axiosCall(e,t,"post",n)},isSuccess:function(r){return!("object"!=typeof r||!r.hasOwnProperty(e)||!r.hasOwnProperty(t)||0!=r.error)},isError:function(e){return!r.isSuccess(e)},hasData:function(e){return!(!r.isSuccess(e)||!("object"==typeof e[t]&&Object.keys(e[t]).length>0||"array"==typeof e[t]&&e[t].length>0||"string"==typeof e[t]&&""!=e[t].trim()||"number"==typeof e[t]))},getData:function(e){return r.hasData(e)?e[t]:null},getError:function(e){return"object"==typeof e&&Object.keys(e).length>0&&e.hasOwnProperty(t)?e[t]:"Generic error"},getErrorCode:function(t){return"object"==typeof t&&t.hasOwnProperty(e)?t[e]:1},_generateRouterURI:function(e){var t=null;return"undefined"!=typeof FHC_JS_DATA_STORAGE_OBJECT&&(t=FHC_JS_DATA_STORAGE_OBJECT.app_root+FHC_JS_DATA_STORAGE_OBJECT.ci_router+"/"+e),t},_printDebug:function(e,t,r){},_axiosCall:function(e,t,n,i){let o={method:n,url:r._generateRouterURI(e),timeout:5e3};if("get"==n?o.params=t:o.data=t,"object"==typeof i)for(var s in i)o[s]=i[s];return axios(o)}},n=2e3,i={getStudiensemester:function(){return r.get("codex/Bismeldestichtag/getStudiensemester",null,{timeout:n})},getBismeldestichtage:function(){return r.get("codex/Bismeldestichtag/getBismeldestichtage",null,{timeout:n})},addBismeldestichtag:function(e){return r.post("codex/Bismeldestichtag/addBismeldestichtag",{meldestichtag:e.meldestichtag,studiensemester_kurzbz:e.studiensemester_kurzbz},{timeout:n})},deleteBismeldestichtag:function(e){return r.post("codex/Bismeldestichtag/deleteBismeldestichtag",{meldestichtag_id:e.meldestichtag_id},{timeout:n})}};export{i as BismeldestichtagAPIs};
|
||||
//# sourceMappingURL=API.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const t={formatDate:function(t){return t.replace(/(.*)-(.*)-(.*)/,"$3.$2.$1")}};export{t as BismeldestichtagHelper};
|
||||
//# sourceMappingURL=BismeldestichtagHelper.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BismeldestichtagHelper.js","sources":["../../../../js/apps/Bismeldestichtag/BismeldestichtagHelper.js"],"sourcesContent":["/**\n * Copyright (C) 2022 fhcomplete.org\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nexport const BismeldestichtagHelper = {\n\tformatDate: function(date) {\n\t\treturn date.replace(/(.*)-(.*)-(.*)/, '$3.$2.$1');\n\t}\n}\n"],"names":["BismeldestichtagHelper","formatDate","date","replace"],"mappings":"AAiBO,MAAMA,EAAyB,CACrCC,WAAY,SAASC,GACpB,OAAOA,EAAKC,QAAQ,iBAAkB,WACvC"}
|
||||
Vendored
+4
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Vendored
+6
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Vendored
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const e={height:700,layout:"fitColumns",columns:[{title:"Log ID",field:"LogId",headerFilter:!0},{title:"Request ID",field:"RequestId",headerFilter:!0},{title:"Execution time",field:"ExecutionTime",headerFilter:!0},{title:"Executed by",field:"ExecutedBy",headerFilter:!0},{title:"Description",field:"Description",headerFilter:!0},{title:"Data",field:"Data",headerFilter:!0},{title:"Web service type",field:"WebserviceType",headerFilter:!0}],rowFormatter:function(e){let t=e.getData();if(null!=t&&t.hasOwnProperty("RequestId")&&null!=t.RequestId){let l=t.RequestId;l.includes("error")?e.getElement().style.color="red":l.includes("warning")&&(e.getElement().style.color="orange")}}},t=[{event:"rowClick",handler:function(e,t){alert(t.getData().Data)}}];export{t as LogsViewerTabulatorEventHandlers,e as LogsViewerTabulatorOptions};
|
||||
//# sourceMappingURL=TabulatorSetup.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TabulatorSetup.js","sources":["../../../../js/apps/LogsViewer/TabulatorSetup.js"],"sourcesContent":["/**\n * Copyright (C) 2022 fhcomplete.org\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n *\n */\nexport const LogsViewerTabulatorOptions = {\n\theight: 700,\n\tlayout: 'fitColumns',\n\tcolumns: [\n\t\t{title: 'Log ID', field: 'LogId', headerFilter: true},\n\t\t{title: 'Request ID', field: 'RequestId', headerFilter: true},\n\t\t{title: 'Execution time', field: 'ExecutionTime', headerFilter: true},\n\t\t{title: 'Executed by', field: 'ExecutedBy', headerFilter: true},\n\t\t{title: 'Description', field: 'Description', headerFilter: true},\n\t\t{title: 'Data', field: 'Data', headerFilter: true},\n\t\t{title: 'Web service type', field: 'WebserviceType', headerFilter: true}\n\t],\n\trowFormatter: function(row) {\n\n\t\tlet data = row.getData(); // get data for this row\n\n\t\t// If data is not null and provides the property RequestId and it is not null\n\t\tif (data != null && data.hasOwnProperty('RequestId') && data.RequestId != null)\n\t\t{\n\t\t\tlet requestId = data.RequestId;\n\n\t\t\tif (requestId.includes(\"error\"))\n\t\t\t{\n\t\t\t\trow.getElement().style.color = \"red\";\n\t\t\t}\n\t\t\telse if (requestId.includes(\"warning\"))\n\t\t\t{\n\t\t\t\trow.getElement().style.color = \"orange\";\n\t\t\t\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n *\n */\nexport const LogsViewerTabulatorEventHandlers = [\n\t{\n\t\tevent: \"rowClick\",\n\t\thandler: function(e, row) {\n\t\t\talert(row.getData().Data);\n\t\t}\n\t}\n];\n\n"],"names":["LogsViewerTabulatorOptions","height","layout","columns","title","field","headerFilter","rowFormatter","row","data","getData","hasOwnProperty","RequestId","requestId","includes","getElement","style","color","LogsViewerTabulatorEventHandlers","event","handler","e","alert","Data"],"mappings":"AAoBO,MAAMA,EAA6B,CACzCC,OAAQ,IACRC,OAAQ,aACRC,QAAS,CACR,CAACC,MAAO,SAAUC,MAAO,QAASC,cAAc,GAChD,CAACF,MAAO,aAAcC,MAAO,YAAaC,cAAc,GACxD,CAACF,MAAO,iBAAkBC,MAAO,gBAAiBC,cAAc,GAChE,CAACF,MAAO,cAAeC,MAAO,aAAcC,cAAc,GAC1D,CAACF,MAAO,cAAeC,MAAO,cAAeC,cAAc,GAC3D,CAACF,MAAO,OAAQC,MAAO,OAAQC,cAAc,GAC7C,CAACF,MAAO,mBAAoBC,MAAO,iBAAkBC,cAAc,IAEpEC,aAAc,SAASC,GAEtB,IAAIC,EAAOD,EAAIE,UAGf,GAAY,MAARD,GAAgBA,EAAKE,eAAe,cAAkC,MAAlBF,EAAKG,UAC7D,CACC,IAAIC,EAAYJ,EAAKG,UAEjBC,EAAUC,SAAS,SAEtBN,EAAIO,aAAaC,MAAMC,MAAQ,MAEvBJ,EAAUC,SAAS,aAE3BN,EAAIO,aAAaC,MAAMC,MAAQ,SAGjC,CACD,GAMYC,EAAmC,CAC/C,CACCC,MAAO,WACPC,QAAS,SAASC,EAAGb,GACpBc,MAAMd,EAAIE,UAAUa,KACrB"}
|
||||
+4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+13
@@ -0,0 +1,13 @@
|
||||
var Search = {
|
||||
search: function (searchsettings) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/SearchBar/search';
|
||||
return axios.post(url, searchsettings);
|
||||
}
|
||||
};
|
||||
|
||||
var fhcapifactory = {
|
||||
"search": Search
|
||||
};
|
||||
|
||||
export { fhcapifactory as default };
|
||||
//# sourceMappingURL=fhcapifactory.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fhcapifactory.js","sources":["../../../../js/apps/api/search.js","../../../../js/apps/api/fhcapifactory.js"],"sourcesContent":["export default {\n search: function(searchsettings) {\n const url = FHC_JS_DATA_STORAGE_OBJECT.app_root \n + FHC_JS_DATA_STORAGE_OBJECT.ci_router\n + '/components/SearchBar/search';\n return axios.post(url, searchsettings);\n }\n};\n","import Search from \"./search.js\";\n\nexport default {\n \"search\": Search,\n};\n"],"names":["search","searchsettings","url","FHC_JS_DATA_STORAGE_OBJECT","app_root","ci_router","axios","post","Search"],"mappings":"AAAA,aAAe;AACbA,EAAAA,MAAM,EAAE,UAASC,cAAc,EAAE;IAC7B,MAAMC,GAAG,GAAGC,0BAA0B,CAACC,QAAQ,GACnCD,0BAA0B,CAACE,SAAS,GACpC,8BAA8B;AAC1C,IAAA,OAAOC,KAAK,CAACC,IAAI,CAACL,GAAG,EAAED,cAAc,CAAC;AAC1C,EAAA;AACF,CAAC;;ACLD,oBAAe;AACX,EAAA,QAAQ,EAAEO;AACd,CAAC;;;;"}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
var search = {
|
||||
search: function (searchsettings) {
|
||||
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/components/SearchBar/search';
|
||||
return axios.post(url, searchsettings);
|
||||
}
|
||||
};
|
||||
|
||||
export { search as default };
|
||||
//# sourceMappingURL=search.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"search.js","sources":["../../../../js/apps/api/search.js"],"sourcesContent":["export default {\n search: function(searchsettings) {\n const url = FHC_JS_DATA_STORAGE_OBJECT.app_root \n + FHC_JS_DATA_STORAGE_OBJECT.ci_router\n + '/components/SearchBar/search';\n return axios.post(url, searchsettings);\n }\n};\n"],"names":["search","searchsettings","url","FHC_JS_DATA_STORAGE_OBJECT","app_root","ci_router","axios","post"],"mappings":"AAAA,aAAe;AACbA,EAAAA,MAAM,EAAE,UAASC,cAAc,EAAE;IAC7B,MAAMC,GAAG,GAAGC,0BAA0B,CAACC,QAAQ,GACnCD,0BAA0B,CAACE,SAAS,GACpC,8BAA8B;AAC1C,IAAA,OAAOC,KAAK,CAACC,IAAI,CAACL,GAAG,EAAED,cAAc,CAAC;AAC1C,EAAA;AACF,CAAC;;;;"}
|
||||
Vendored
+4
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,6 +2,8 @@ import BsModal from "../Bootstrap/Modal.js";
|
||||
import CachedWidgetLoader from "../../composables/Dashboard/CachedWidgetLoader.js";
|
||||
import HeightTransition from "../Tranistion/HeightTransition.js";
|
||||
|
||||
import {absoluteJsImportUrl} from "../../helpers/UrlHelpers.js";
|
||||
|
||||
export default {
|
||||
name: 'Item',
|
||||
components: {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
const absoluteJsImportUrl = function(relativeurl)
|
||||
{
|
||||
if(true === FHC_JS_DATA_STORAGE_OBJECT.use_fhcomplete_build_version_in_path)
|
||||
{
|
||||
const absoluteurl = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ relativeurl.replace(
|
||||
/^public\//,
|
||||
'public/' + FHC_JS_DATA_STORAGE_OBJECT.fhcomplete_build_version + '/'
|
||||
);
|
||||
return absoluteurl;
|
||||
}
|
||||
else
|
||||
{
|
||||
const absoluteurl = FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
+ relativeurl
|
||||
+ '?'
|
||||
+ FHC_JS_DATA_STORAGE_OBJECT.fhcomplete_build_version;
|
||||
return absoluteurl;
|
||||
}
|
||||
};
|
||||
|
||||
export { absoluteJsImportUrl };
|
||||
@@ -0,0 +1,29 @@
|
||||
***NVM installieren***
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
|
||||
oder
|
||||
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
|
||||
***Node.js installieren***
|
||||
|
||||
nvm install --lts
|
||||
|
||||
***package.json***
|
||||
|
||||
npm install
|
||||
|
||||
***Rollup build***
|
||||
|
||||
einmalig:
|
||||
|
||||
npm run build
|
||||
|
||||
mit debug ausgaben:
|
||||
|
||||
DEBUG=true npm run build
|
||||
|
||||
als watch bei Änderungen:
|
||||
|
||||
npm run watch
|
||||
@@ -0,0 +1,99 @@
|
||||
import babel from '@rollup/plugin-babel';
|
||||
import nodeResolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import vue from "rollup-plugin-vue";
|
||||
import { globSync } from 'glob';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import alias from '@rollup/plugin-alias';
|
||||
import { existsSync } from 'node:fs';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
function FhcResolver () {
|
||||
return {
|
||||
name: 'fhc-resolver', // this name will show up in logs and errors
|
||||
resolveId ( source, importer, options ) {
|
||||
if( source.includes('.php') ) {
|
||||
return false;
|
||||
}
|
||||
//console.log('source: ' + source + ' options.isEntry: ' + options.isEntry + ' importer: ' + importer);
|
||||
if(importer !== undefined && !options.isEntry && !path.isAbsolute(source)) {
|
||||
let tmp = path.dirname(importer);
|
||||
if( importer.includes('/application/') ) {
|
||||
tmp = tmp.replace(/public\/js\//, 'js/').replace(/\/application\//, '/public/');
|
||||
}
|
||||
const resolved = path.resolve(tmp, source);
|
||||
//console.log(resolved);
|
||||
if( existsSync(resolved) ) {
|
||||
return resolved
|
||||
}
|
||||
}
|
||||
return null; // other ids should be handled as usually
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
input: Object.fromEntries(
|
||||
globSync('public/**/js/apps/**/*.js', {follow: true, realpath: true}).map(file => {
|
||||
if( path.dirname(file).includes('/dist/') || path.dirname(file).includes('/apps/vbform') ) {
|
||||
return null;
|
||||
}
|
||||
// This remove `src/` as well as the file extension from each
|
||||
// file, so e.g. src/nested/foo.js becomes nested/foo
|
||||
return [path.relative(
|
||||
'',
|
||||
file.slice(0, file.length - path.extname(file).length)
|
||||
).replace(/public\//, 'public/dist/'),
|
||||
// This expands the relative paths to absolute paths, so e.g.
|
||||
// src/nested/foo becomes /project/src/nested/foo.js
|
||||
fileURLToPath(new URL(file, import.meta.url))]
|
||||
}).filter(Boolean)
|
||||
),
|
||||
plugins: [
|
||||
alias({
|
||||
entries: {
|
||||
vue: 'vue/dist/vue.esm-bundler.js'
|
||||
}
|
||||
}),
|
||||
nodeResolve({
|
||||
preferBuiltins: true,
|
||||
moduleDirectories: ['node_modules'],
|
||||
modulePaths: globSync('application/extensions/*/node_modules', {follow: true, realpath: true}).map(file =>
|
||||
fileURLToPath(new URL(file, import.meta.url))
|
||||
),
|
||||
}),
|
||||
FhcResolver(),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify( 'production' ),
|
||||
}),
|
||||
commonjs(),
|
||||
vue(),
|
||||
json(),
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
plugins: ['transform-class-properties']
|
||||
}),
|
||||
postcss({
|
||||
extract: false,
|
||||
modules: true,
|
||||
use: ['sass'],
|
||||
}),
|
||||
terser()
|
||||
],
|
||||
watch: {
|
||||
buildDelay: 500
|
||||
},
|
||||
output: {
|
||||
preserveModules: false,
|
||||
sourcemap: true,
|
||||
format: 'es',
|
||||
dir: './',
|
||||
//manualChunks: {}
|
||||
chunkFileNames: 'public/dist/js/includes/[name]-[hash].js'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,158 @@
|
||||
import babel from '@rollup/plugin-babel';
|
||||
import { globSync } from 'glob';
|
||||
import path from 'node:path';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import { existsSync } from 'node:fs';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
const debug = (process.env.DEBUG !== undefined) && (process.env.DEBUG === "true");
|
||||
|
||||
const fhcbasepath = import.meta.dirname;
|
||||
|
||||
let apps = {};
|
||||
let curapp = null;
|
||||
|
||||
console.log(process.env.DEBUG + ' ' + debug);
|
||||
|
||||
function FhcResolver () {
|
||||
return {
|
||||
name: 'fhc-resolver', // this name will show up in logs and errors
|
||||
buildStart (options) {
|
||||
curapp = apps[options.input[0]];
|
||||
|
||||
if(debug)
|
||||
{
|
||||
console.log('--------------------------------');
|
||||
console.log('fhc-resolver buildStart');
|
||||
console.log('options: ' + JSON.stringify(options, null, "\t"));
|
||||
console.log('apps: ' + JSON.stringify(apps, null, "\t"));
|
||||
console.log('curapp: ' + curapp);
|
||||
console.log('--------------------------------');
|
||||
}
|
||||
},
|
||||
resolveId ( source, importer, options ) {
|
||||
debug && console.log('source: ' + source + ' curapp: ' + curapp + ' importer: ' + importer);
|
||||
|
||||
if(importer === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if( source.includes('index.ci.php') ) {
|
||||
let source_abs = fhcbasepath + '/' + source.replace(/(\.\.\/)+/, '');
|
||||
let source_rel = path.relative(path.dirname(curapp), source_abs);
|
||||
|
||||
debug && console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel);
|
||||
|
||||
return { id: source_rel, external: 'relative'};
|
||||
}
|
||||
|
||||
if( source.includes('.php') ) {
|
||||
let source_abs = path.resolve(path.dirname(importer), source);
|
||||
if(source_abs.match(/\/FHC-Core-[^\/]+\/public\//)) {
|
||||
source_abs = fhcbasepath + source_abs.replace(/^.+?\/(FHC-Core-[^\/]+)\/public\//, '/public/extensions/$1/');
|
||||
}
|
||||
let source_rel = path.relative(path.dirname(curapp), source_abs);
|
||||
|
||||
debug && console.log('SOURCE_ABS:' + source_abs + 'APP: ' + curapp + 'SOURCE_REL: ' + source_rel);
|
||||
|
||||
return { id: source_rel, external: 'relative'};
|
||||
}
|
||||
|
||||
let resolved = null;
|
||||
|
||||
if(!path.isAbsolute(source)) {
|
||||
let tmp = path.dirname(importer);
|
||||
|
||||
if( importer.includes('/application/') ) {
|
||||
tmp = tmp.replace(/public\/js\//, 'js/').replace(/\/application\//, '/public/');
|
||||
}
|
||||
else if( importer.includes('/FHC-Core-') && !importer.includes('/extensions/') ) {
|
||||
tmp = fhcbasepath + tmp.replace(/^.+?\/(FHC-Core-[^\/]+)\/public\//, '/public/extensions/$1/');
|
||||
}
|
||||
|
||||
resolved = path.resolve(tmp, source);
|
||||
} else {
|
||||
resolved = source;
|
||||
|
||||
if( source.includes('/FHC-Core-') && !source.includes('/extensions/') )
|
||||
{
|
||||
resolved = fhcbasepath + source.replace(/^.+?\/(FHC-Core-[^\/]+)\/public\//, '/public/extensions/$1/');
|
||||
}
|
||||
}
|
||||
|
||||
if( resolved !== null && !existsSync(resolved) ) {
|
||||
console.log('not existsSync: ' + resolved + ' source: ' + source + ' importer: ' + importer);
|
||||
}
|
||||
|
||||
return resolved;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const useplugins = [
|
||||
json({
|
||||
compact: true
|
||||
}),
|
||||
FhcResolver(),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify( 'production' ),
|
||||
}),
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
plugins: ['transform-class-properties'],
|
||||
}),
|
||||
terser()
|
||||
];
|
||||
|
||||
export default globSync('public/**/js/apps/**/*.js', {follow: false, realpath: false}).map(file => {
|
||||
if( path.dirname(file).includes('/dist/')
|
||||
|| path.dirname(file).includes('/apps/vbform')
|
||||
|| path.dirname(file).includes('/apps/api')
|
||||
|| path.basename(file) === 'common.js'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const inputfile = fhcbasepath + '/' + file;
|
||||
const outputfile = inputfile.replace(/public\//, 'public/dist/');
|
||||
const cssfile = path.basename(inputfile.replace(/\.js/, '.css'));
|
||||
|
||||
apps[inputfile] = outputfile;
|
||||
|
||||
if(debug)
|
||||
{
|
||||
console.log('--------------------------------');
|
||||
console.log('fhcbasepath: ' + fhcbasepath);
|
||||
console.log('file: ' + file);
|
||||
console.log('inputfile: ' + inputfile);
|
||||
console.log('outputfile: ' + outputfile);
|
||||
console.log('cssfile: ' + cssfile);
|
||||
console.log('--------------------------------');
|
||||
}
|
||||
|
||||
const cssplugin = [
|
||||
postcss({
|
||||
extract: cssfile,
|
||||
minimize: true,
|
||||
sourceMap: true
|
||||
})
|
||||
];
|
||||
|
||||
return {
|
||||
input: inputfile,
|
||||
plugins: [...useplugins, ...cssplugin],
|
||||
watch: {
|
||||
buildDelay: 500
|
||||
},
|
||||
output: {
|
||||
preserveModules: false,
|
||||
inlineDynamicImports: true,
|
||||
sourcemap: true,
|
||||
format: 'es',
|
||||
file: outputfile,
|
||||
}
|
||||
}
|
||||
}).filter(Boolean);
|
||||
Reference in New Issue
Block a user