Skip to content

Commit

Permalink
feat(core): remove Core JS lazy modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Feb 7, 2023
1 parent 79dc849 commit 25a9c8e
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 403 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@
"Samsung >= 12"
],
"dependencies": {
"dom7": "^4.0.4",
"dom7": "^4.0.6",
"htm": "^3.1.1",
"path-to-regexp": "^6.2.0",
"skeleton-elements": "^4.0.1",
"ssr-window": "^4.0.2",
"swiper": "^9.0.0-beta.25"
"swiper": "^9.0.3"
},
"devDependencies": {
"@babel/cli": "^7.19.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,11 @@
"url": "https://www.patreon.com/framework7"
},
"dependencies": {
"dom7": "^4.0.4",
"dom7": "^4.0.6",
"htm": "^3.1.1",
"path-to-regexp": "^6.2.0",
"skeleton-elements": "^4.0.1",
"ssr-window": "^4.0.2",
"swiper": "^9.0.0-beta.21"
"swiper": "^9.0.3"
}
}
69 changes: 0 additions & 69 deletions scripts/build-core-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,76 +215,8 @@ async function umdBundle({ components } = {}) {
});
}

async function umdCore() {
const config = getConfig();
const env = process.env.NODE_ENV || 'development';
const format = process.env.FORMAT || config.format || 'umd';
const output = path.resolve(`${getOutput()}`, 'core');

return rollup({
input: './src/core/framework7.js',
plugins: [
replace({
delimiters: ['', ''],
'process.env.NODE_ENV': JSON.stringify(env), // or 'production'
'process.env.FORMAT': JSON.stringify(format),
'//IMPORT_COMPONENTS': '',
'//INSTALL_COMPONENTS': '',
'//IMPORT_HELPERS': '',
'//NAMED_EXPORT': '',
'export { $ as Dom7, utils, getDevice, getSupport, createStore, $jsx };': '',
}),
nodeResolve({ mainFields: ['module', 'main', 'jsnext'] }),
babel({ babelHelpers: 'bundled' }),
commonjs(),
],
onwarn(warning, warn) {
const ignore = ['EVAL'];
if (warning.code && ignore.indexOf(warning.code) >= 0) {
return;
}
warn(warning);
},
})
.then((bundle) => {
// eslint-disable-line
return bundle.write({
strict: true,
file: `${output}/framework7.js`,
format: 'umd',
name: 'Framework7',
sourcemap: env === 'production',
sourcemapFile: `${output}/framework7.js.map`,
banner,
});
})
.then(async (bundle) => {
if (env === 'development') {
return;
}
const result = bundle.output[0];
const minified = await minify(result.code, {
sourceMap: {
content: env === 'production' ? result.map : undefined,
filename: env === 'production' ? 'framework7.min.js' : undefined,
url: `framework7.min.js.map`,
},
output: {
preamble: banner,
},
});

fs.writeFileSync(`${output}/framework7.min.js`, minified.code);
fs.writeFileSync(`${output}/framework7.min.js.map`, minified.map);
})
.catch((err) => {
console.log(err);
});
}

async function buildJs(cb) {
const config = getConfig();
const env = process.env.NODE_ENV || 'development';

const components = [];
config.components.forEach((name) => {
Expand Down Expand Up @@ -312,7 +244,6 @@ async function buildJs(cb) {
}

if (!process.env.CORE_BUILD_ONLY_MODULES) {
if (env !== 'development') await umdCore();
await umdBundle({ components });
}

Expand Down
Loading

0 comments on commit 25a9c8e

Please sign in to comment.