mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-19 05:51:35 +08:00
952f2f7cc2
* feat(hippy-vue-next): add ssr style parser
* feat(hippy-vue-next): add ssr runtime support
* feat(vue-next): add server renderer package
* feat(vue-next): server-renderer normal version commit
* feat(vue-next): optimize text render function
* feat(vue-next): add ssr render & compiler package
* feat(vue-next): init vue-next-ssr-demo
* feat(vue-next): ssr support scoped style & ssr bug fix
* feat(vue-next): fix ssr style issue
* feat(vue-next): fix ssr demo problem
* feat(vue-next): add webpack ssr build config
* feat(vue-next): webpack ssr demo commit
* feat(vue-next): fix build problem
* feat(vue-next): fix build problem
* feat(vue-next): fix ssr build problem
* docs(vue-next): add ssr description doc
* docs(vue-next): add how to use ssr doc& update demo readme
* docs(vue-next): add ssr how to use and description
* docs(vue-next): add ssr architecture image
* feat(vue-next): add ssr store usage & update docs
* feat(vue-next): add ssr unit-test and style parser unit-test
* feat(vue-next): add server-render unit test case
* feat(vue-next): add server-render vnode unit test case
* feat(vue-next): add server-render unit test case
* feat(vue-next): add compiler-ssr unit test case
* feat(vue-next): add ssr related unit test case & commit
* feat(vue-next): commit totally native component ssr support
* feat(vue-next): complete ssr render event map
* feat(vue-next): complete ssr render event map & add unit test case
* feat(vue-next): complete ssr render event map & add unit test case
* Revert "feat(vue-next): complete ssr render event map & add unit test case"
This reverts commit 72ac570f4e.
* feat(vue-next): add unit test setup file
* feat(vue-next): resolve fragment render problem
* feat(vue-next): fix native component render problem
* feat(vue-next): modify native component render unit test case
* fix(vue-next): fix websocket demo field name issue
* fix(vue-next): fix ssr demo platform issue
* fix(vue-next): fix ssr text node render issue
* feat(vue-next): add ssr text node render unit test case
* feat(vue-next-demo): optimize ssr build
* feat(vue-next): compatible node props and style props
* feat(vue-next): compatible fontWeight && placeholder
* feat(vue-next): specify ssr package types & update demo pinia version
* feat(vue-next): compatible iframe ssr load issue
* feat(vue-next): compatible ssr style & store issue
* feat(vue-next): fix iframe ssr props issue
* feat(vue-next): fix textInput ssr props & style issue
* feat(vue-next): fix waterfall ssr issue
* feat(vue-next): fix pull-header-footer ssr issue
* feat(vue-next): fix nested scroll ssr issue
* feat(vue-next): fix loop animation ssr issue
* feat(vue-next): fix animation demo ssr issue
* feat(vue-next): fix div demo & css comment property issue
* feat(vue-next): fix all ssr demo issue
* feat(vue-next): commit ssr dev mode all logic
* feat(vue-next): dev & build tools complete
* feat(vue-next): optimize dev experience
* docs(vue-next): update ssr usage doc
* feat(vue-next): add ssr render & style unit test case
* feat(vue-next): add ssr style-parse & ssr node parse unit test case
* docs(vue-next): optimize ssr doc
* feat(vue-next): update ssr demo node engines min version
* feat(vue-next): optimize ssr render string transform performance
* feat(vue-next): add new dir for ssr demo
* feat(vue-next): fix ssr demo issue & optimize comment
* feat(vue-next): fix div demo issue & native background android issue
* docs(vue-next): update ssr docs
* docs(vue-next): update vue-next ssr docs
109 lines
3.3 KiB
JavaScript
109 lines
3.3 KiB
JavaScript
/*
|
|
* Tencent is pleased to support the open source community by making
|
|
* Hippy available.
|
|
*
|
|
* Copyright (C) 2017-2022 THL A29 Limited, a Tencent company.
|
|
* All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const { rollup } = require('rollup');
|
|
const reactBuilds = require('./react-configs').getAllBuilds();
|
|
const reactWebBuilds = require('./react-web-configs').getAllBuilds();
|
|
const vueBuilds = require('./vue-configs').getAllBuilds();
|
|
const vueNextBuilds = require('./vue-next-configs').getAllBuilds();
|
|
const webRendererBuilds = require('./web-renderer-configs').getAllBuilds();
|
|
let builds = [...reactBuilds, ...reactWebBuilds, ...vueBuilds, ...vueNextBuilds, ...webRendererBuilds];
|
|
|
|
// filter builds via command line arg
|
|
if (process.argv[2]) {
|
|
const filters = process.argv[2].split(',');
|
|
builds = builds.filter(b => filters.some(f => b.output.file?.indexOf(f) > -1 || b.output.name?.indexOf(f) > -1));
|
|
}
|
|
|
|
function blue(str) {
|
|
return `\x1b[1m\x1b[34m${str}\x1b[39m\x1b[22m`;
|
|
}
|
|
|
|
function getSize(code) {
|
|
return `${(code.length / 1024).toFixed(2)}kb`;
|
|
}
|
|
|
|
function logError(e) {
|
|
console.error('build js packages error', e);
|
|
process.exit(1);
|
|
}
|
|
|
|
/**
|
|
* remove typescript declaration files that generated by rollup plugin.
|
|
*
|
|
* 1. auto generate typescript declaration files by rollup-plugin-typescript2
|
|
* 2. declaration files rollup to index.d.ts by rollup-plugin-dts
|
|
* 3. remove auto generated declaration files
|
|
*
|
|
* @param filePath
|
|
*/
|
|
function cleanTypescriptDeclarationFiles(filePath) {
|
|
if (filePath) {
|
|
let isDir = fs.statSync(filePath);
|
|
const dir = isDir.isDirectory() ? filePath : path.dirname(filePath);
|
|
const subDirs = fs.readdirSync(dir);
|
|
if (subDirs.length) {
|
|
for (let i = 0; i <= subDirs.length; i++) {
|
|
if (subDirs[i]) {
|
|
const dirPath = `${dir}/${subDirs[i]}`;
|
|
isDir = fs.statSync(dirPath);
|
|
if (isDir?.isDirectory() && subDirs[i].startsWith('hippy-')) {
|
|
fs.rmSync(dirPath, {
|
|
force: true,
|
|
recursive: true,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
async function buildEntry(config) {
|
|
const { output } = config;
|
|
const { file = '', dir = '' } = output;
|
|
const bundle = await rollup(config);
|
|
await bundle.generate(output);
|
|
const { output: [{ code }] } = await bundle.write(output);
|
|
console.log(`${blue(path.relative(process.cwd(), file ? file : `${dir}/index.js`))} ${getSize(code)}`);
|
|
|
|
cleanTypescriptDeclarationFiles(file || dir);
|
|
}
|
|
|
|
function build(buildSets) {
|
|
let built = 0;
|
|
const total = builds.length;
|
|
const next = () => {
|
|
buildEntry(buildSets[built])
|
|
.then(() => {
|
|
built += 1;
|
|
if (built < total) {
|
|
next();
|
|
}
|
|
})
|
|
.catch(logError);
|
|
};
|
|
next();
|
|
}
|
|
|
|
build(builds);
|