From 1d25ecf02ce0465bcf389da09aa9f981cdad87a3 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:29:20 +0300 Subject: [PATCH 1/8] no minify, uglify --- apps/demos/utils/bundle/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 4e8f7184674d..8efe193d697b 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -109,7 +109,7 @@ const prepareConfigs = (framework)=> { let modulesMap = {}; let main = `devextreme-${framework}/index.js`; - let minify = true; + let minify = false; if (framework === 'angular') { additionPackage = [{ @@ -128,7 +128,6 @@ const prepareConfigs = (framework)=> { // eslint-disable-next-line spellcheck/spell-checker if (currentPackage.module?.startsWith('fesm2022')) { main = `devextreme-${framework}`; - minify = false; prepareDevextremexAngularFiles(); @@ -202,7 +201,7 @@ const prepareConfigs = (framework)=> { bundlePath: `bundles/devextreme.${framework}.systemjs.js`, bundleOpts: { minify, - uglify: { mangle: true }, + uglify: { mangle: false }, async fetch(load, fetch) { if(load?.metadata?.transpile) { // access to path-specific meta if required: load?.metadata?.babelOptions From c0cac0929f815cb5a009b107889d53b83aeb49e3 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:42:46 +0300 Subject: [PATCH 2/8] path(s) for certain es modules --- apps/demos/utils/bundle/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 8efe193d697b..68c72708f24b 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -23,8 +23,9 @@ const prepareModulesToNamedImport = () => { ]; const paths = [ - '../npm-scripts/npm-devextreme/cjs', - 'node_modules/devextreme/cjs', + '../npm-scripts/npm-devextreme/cjs', // un-used / legacy? + 'node_modules/devextreme/cjs', // mono repo + 'overwrite-wrappers-packages' + '../../node_modules/devextreme/cjs', // wg & no 'overwrite-wrappers-packages' ]; const esModuleExport = 'exports.__esModule = true;'; From 7511dd4534f614c933cd16698ccd790a9edeb401 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Tue, 11 Jun 2024 00:11:03 +0300 Subject: [PATCH 3/8] duplicate module --- apps/demos/utils/bundle/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 68c72708f24b..1cd147558309 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -9,7 +9,6 @@ const url = require('url'); // https://stackoverflow.com/questions/42412965/how-to-load-named-exports-with-systemjs/47108328 const prepareModulesToNamedImport = () => { const modules = [ - 'time_zone_utils.js', 'localization.js', 'viz/export.js', 'viz/core/export.js', From 5a4a77dcb5cf52aef4610b16b211985519681bec Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Tue, 11 Jun 2024 00:17:37 +0300 Subject: [PATCH 4/8] esModule for devextreme --- apps/demos/utils/bundle/index.js | 40 +------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 1cd147558309..b0bfd19cbb95 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -5,44 +5,6 @@ const Builder = require('systemjs-builder'); const babel = require('@babel/core'); const url = require('url'); - -// https://stackoverflow.com/questions/42412965/how-to-load-named-exports-with-systemjs/47108328 -const prepareModulesToNamedImport = () => { - const modules = [ - 'localization.js', - 'viz/export.js', - 'viz/core/export.js', - 'viz/vector_map/projection.js', - 'viz/palette.js', - 'excel_exporter.js', - 'pdf_exporter.js', - 'time_zone_utils.js', - 'devextreme/ui/dialog.js', - 'common/charts.js', - ]; - - const paths = [ - '../npm-scripts/npm-devextreme/cjs', // un-used / legacy? - 'node_modules/devextreme/cjs', // mono repo + 'overwrite-wrappers-packages' - '../../node_modules/devextreme/cjs', // wg & no 'overwrite-wrappers-packages' - ]; - - const esModuleExport = 'exports.__esModule = true;'; - - paths.forEach((p) => { - modules.forEach((name) => { - const filePath = `${p}/${name}`; - - if (fs.existsSync(filePath)) { - const fileText = fs.readFileSync(filePath, 'utf8'); - if (fileText.search(esModuleExport) === -1) { - fs.appendFileSync(filePath, `\n ${esModuleExport}`); - } - } - }); - }); -}; - const getDefaultBuilderConfig = (framework, additionPaths, map) => ({ defaultExtension: false, defaultJSExtensions: 'js', @@ -62,6 +24,7 @@ const getDefaultBuilderConfig = (framework, additionPaths, map) => ({ }, 'devextreme/*': { build: true, + esModule: true, }, 'devexpress-gantt': { build: true, @@ -236,7 +199,6 @@ const prepareConfigs = (framework)=> { const build = async (framework) => { const builder = new Builder(); - prepareModulesToNamedImport(); const { builderConfig, packages, bundlePath, bundleOpts, From e1df32e7ca9ae4334e0a8873da4b510f7e49efc0 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:11:32 +0300 Subject: [PATCH 5/8] Revert "esModule for devextreme" This reverts commit 5a4a77dcb5cf52aef4610b16b211985519681bec. --- apps/demos/utils/bundle/index.js | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index b0bfd19cbb95..1cd147558309 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -5,6 +5,44 @@ const Builder = require('systemjs-builder'); const babel = require('@babel/core'); const url = require('url'); + +// https://stackoverflow.com/questions/42412965/how-to-load-named-exports-with-systemjs/47108328 +const prepareModulesToNamedImport = () => { + const modules = [ + 'localization.js', + 'viz/export.js', + 'viz/core/export.js', + 'viz/vector_map/projection.js', + 'viz/palette.js', + 'excel_exporter.js', + 'pdf_exporter.js', + 'time_zone_utils.js', + 'devextreme/ui/dialog.js', + 'common/charts.js', + ]; + + const paths = [ + '../npm-scripts/npm-devextreme/cjs', // un-used / legacy? + 'node_modules/devextreme/cjs', // mono repo + 'overwrite-wrappers-packages' + '../../node_modules/devextreme/cjs', // wg & no 'overwrite-wrappers-packages' + ]; + + const esModuleExport = 'exports.__esModule = true;'; + + paths.forEach((p) => { + modules.forEach((name) => { + const filePath = `${p}/${name}`; + + if (fs.existsSync(filePath)) { + const fileText = fs.readFileSync(filePath, 'utf8'); + if (fileText.search(esModuleExport) === -1) { + fs.appendFileSync(filePath, `\n ${esModuleExport}`); + } + } + }); + }); +}; + const getDefaultBuilderConfig = (framework, additionPaths, map) => ({ defaultExtension: false, defaultJSExtensions: 'js', @@ -24,7 +62,6 @@ const getDefaultBuilderConfig = (framework, additionPaths, map) => ({ }, 'devextreme/*': { build: true, - esModule: true, }, 'devexpress-gantt': { build: true, @@ -199,6 +236,7 @@ const prepareConfigs = (framework)=> { const build = async (framework) => { const builder = new Builder(); + prepareModulesToNamedImport(); const { builderConfig, packages, bundlePath, bundleOpts, From 42faedc1935eaef1133b628ba4df1a7c41c020a2 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:12:02 +0300 Subject: [PATCH 6/8] Revert "no minify, uglify" This reverts commit 1d25ecf02ce0465bcf389da09aa9f981cdad87a3. --- apps/demos/utils/bundle/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 1cd147558309..8be78ac207c3 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -109,7 +109,7 @@ const prepareConfigs = (framework)=> { let modulesMap = {}; let main = `devextreme-${framework}/index.js`; - let minify = false; + let minify = true; if (framework === 'angular') { additionPackage = [{ @@ -128,6 +128,7 @@ const prepareConfigs = (framework)=> { // eslint-disable-next-line spellcheck/spell-checker if (currentPackage.module?.startsWith('fesm2022')) { main = `devextreme-${framework}`; + minify = false; prepareDevextremexAngularFiles(); @@ -201,7 +202,7 @@ const prepareConfigs = (framework)=> { bundlePath: `bundles/devextreme.${framework}.systemjs.js`, bundleOpts: { minify, - uglify: { mangle: false }, + uglify: { mangle: true }, async fetch(load, fetch) { if(load?.metadata?.transpile) { // access to path-specific meta if required: load?.metadata?.babelOptions From 651d67d74f809041c989d9a510d1c2e24bb22bd2 Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:20:40 +0300 Subject: [PATCH 7/8] comments --- apps/demos/utils/bundle/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 8be78ac207c3..47a984e424f7 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -23,8 +23,8 @@ const prepareModulesToNamedImport = () => { const paths = [ '../npm-scripts/npm-devextreme/cjs', // un-used / legacy? - 'node_modules/devextreme/cjs', // mono repo + 'overwrite-wrappers-packages' - '../../node_modules/devextreme/cjs', // wg & no 'overwrite-wrappers-packages' + 'node_modules/devextreme/cjs', // 24.1+ migrated from devextreme-demos / likely un-used + '../../node_modules/devextreme/cjs', // 24.1+ wg ci ]; const esModuleExport = 'exports.__esModule = true;'; From 2f215108cacc2f1bb37293087e5b147bdce0264e Mon Sep 17 00:00:00 2001 From: Mikhail Preyskurantov <5574159+mpreyskurantov@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:29:41 +0300 Subject: [PATCH 8/8] comments --- apps/demos/utils/bundle/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/demos/utils/bundle/index.js b/apps/demos/utils/bundle/index.js index 47a984e424f7..940bef0f9b8e 100644 --- a/apps/demos/utils/bundle/index.js +++ b/apps/demos/utils/bundle/index.js @@ -23,8 +23,8 @@ const prepareModulesToNamedImport = () => { const paths = [ '../npm-scripts/npm-devextreme/cjs', // un-used / legacy? - 'node_modules/devextreme/cjs', // 24.1+ migrated from devextreme-demos / likely un-used - '../../node_modules/devextreme/cjs', // 24.1+ wg ci + 'node_modules/devextreme/cjs', // 24.1+ migrated from devextreme-demos, kept as is / likely un-used, but works ok in mono repo + '../../node_modules/devextreme/cjs', // 24.1+ wg / individual em modules are not discovered ]; const esModuleExport = 'exports.__esModule = true;';