chore: 更改构建器名称 build > builder

This commit is contained in:
winixt 2022-05-12 10:50:53 +08:00
parent 4caf8fa0fa
commit 060924e241
77 changed files with 55 additions and 87 deletions

View File

@ -4,8 +4,8 @@ module.exports = {
'fes',
'fes-compiler',
'fes-preset-built-in',
'fes-build-vite',
'fes-build-webpack',
'fes-builder-vite',
'fes-builder-webpack',
'fes-runtime',
'fes-utils',
'fes-plugin-access',

View File

@ -48,7 +48,7 @@
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-icon": "^2.0.0",
"@fesjs/plugin-request": "^2.0.0",
"@fesjs/build-webpack": "^1.0.0",
"@fesjs/builder-webpack": "^1.0.0",
"vue": "^3.2.6",
"core-js": "^3.8.3"
},

View File

@ -53,7 +53,7 @@
"@fesjs/plugin-model": "^2.0.0",
"@fesjs/plugin-enums": "^2.0.0",
"@fesjs/fes-design": "^0.4.0",
"@fesjs/build-webpack": "^1.0.0",
"@fesjs/builder-webpack": "^1.0.0",
"vue": "^3.2.6",
"core-js": "^3.8.3"
},

View File

@ -1,6 +0,0 @@
import { winPath } from '@fesjs/utils';
import { dirname } from 'path';
export const runtimePath = winPath(
dirname(require.resolve('@fesjs/runtime/package.json'))
);

View File

@ -1,60 +0,0 @@
import { lodash, winPath } from '@fesjs/utils';
import assert from 'assert';
import path from 'path';
const reserveLibrarys = ['fes']; // reserve library
// todo 插件导出内容冲突问题待解决
const reserveExportsNames = [
'Link',
'NavLink',
'Redirect',
'dynamic',
'withRouter',
'Route'
];
export default function generateExports(basePath, { item, fesExportsHook }) {
assert(item.source, 'source should be supplied.');
const source = path.relative(path.basename(basePath), item.source);
assert(
item.exportAll || item.specifiers,
'exportAll or specifiers should be supplied.'
);
assert(
!reserveLibrarys.includes(source),
`${source} is reserve library, Please don't use it.`
);
if (item.exportAll) {
return `export * from '${winPath(source)}';`;
}
assert(
Array.isArray(item.specifiers),
`specifiers should be Array, but got ${item.specifiers.toString()}.`
);
const specifiersStrArr = item.specifiers.map((specifier) => {
if (typeof specifier === 'string') {
assert(
!reserveExportsNames.includes(specifier),
`${specifier} is reserve name, you can use 'exported' to set alias.`
);
assert(
!fesExportsHook[specifier],
`${specifier} is Defined, you can use 'exported' to set alias.`
);
fesExportsHook[specifier] = true;
return specifier;
}
assert(
lodash.isPlainObject(specifier),
`Configure item context should be Plain Object, but got ${specifier}.`
);
assert(
specifier.local && specifier.exported,
'local and exported should be supplied.'
);
return `${specifier.local} as ${specifier.exported}`;
});
return `export { ${specifiersStrArr.join(', ')} } from '${winPath(
source
)}';`;
}

View File

@ -1,7 +1,7 @@
{
"name": "@fesjs/build-vite",
"name": "@fesjs/builder-vite",
"version": "1.0.0",
"description": "@fesjs/build-vite",
"description": "@fesjs/builder-vite",
"main": "lib/index.js",
"files": [
"lib"
@ -9,7 +9,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-build-vite"
"directory": "packages/fes-builder-vite"
},
"keywords": [
"fes"

View File

@ -1,7 +1,7 @@
{
"name": "@fesjs/build-webpack",
"name": "@fesjs/builder-webpack",
"version": "1.0.0",
"description": "@fesjs/build-webpack",
"description": "@fesjs/builder-webpack",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
@ -10,7 +10,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-build-webpack"
"directory": "packages/fes-builder-webpack"
},
"keywords": [
"fes"

View File

@ -7,7 +7,7 @@ import { relative } from 'path';
import { existsSync } from 'fs';
import { Logger } from '@fesjs/compiler';
const logger = new Logger('fes:build-webpack');
const logger = new Logger('fes:builder-webpack');
export default function (api) {
const {

View File

@ -1,6 +1,6 @@
import { Logger } from '@fesjs/compiler';
const logger = new Logger('fes:build-webpack');
const logger = new Logger('fes:builder-webpack');
export default (api) => {
const {

View File

@ -0,0 +1,4 @@
import { winPath } from '@fesjs/utils';
import { dirname } from 'path';
export const runtimePath = winPath(dirname(require.resolve('@fesjs/runtime/package.json')));

View File

@ -0,0 +1,30 @@
import { lodash, winPath } from '@fesjs/utils';
import assert from 'assert';
import path from 'path';
const reserveLibrarys = ['fes']; // reserve library
// todo 插件导出内容冲突问题待解决
const reserveExportsNames = ['Link', 'NavLink', 'Redirect', 'dynamic', 'withRouter', 'Route'];
export default function generateExports(basePath, { item, fesExportsHook }) {
assert(item.source, 'source should be supplied.');
const source = path.relative(path.basename(basePath), item.source);
assert(item.exportAll || item.specifiers, 'exportAll or specifiers should be supplied.');
assert(!reserveLibrarys.includes(source), `${source} is reserve library, Please don't use it.`);
if (item.exportAll) {
return `export * from '${winPath(source)}';`;
}
assert(Array.isArray(item.specifiers), `specifiers should be Array, but got ${item.specifiers.toString()}.`);
const specifiersStrArr = item.specifiers.map((specifier) => {
if (typeof specifier === 'string') {
assert(!reserveExportsNames.includes(specifier), `${specifier} is reserve name, you can use 'exported' to set alias.`);
assert(!fesExportsHook[specifier], `${specifier} is Defined, you can use 'exported' to set alias.`);
fesExportsHook[specifier] = true;
return specifier;
}
assert(lodash.isPlainObject(specifier), `Configure item context should be Plain Object, but got ${specifier}.`);
assert(specifier.local && specifier.exported, 'local and exported should be supplied.');
return `${specifier.local} as ${specifier.exported}`;
});
return `export { ${specifiersStrArr.join(', ')} } from '${winPath(source)}';`;
}

View File

@ -5,7 +5,7 @@ import { PluginType } from '../enums';
const RE = {
[PluginType.plugin]: /^(@fesjs\/|@webank\/fes-|fes-)plugin-/,
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)(preset|build)-/,
[PluginType.preset]: /^(@fesjs\/|@webank\/fes-|fes-)(preset|builder)-/,
};
export function isPluginOrPreset(type, name) {
@ -120,10 +120,10 @@ export function resolvePresets(opts) {
if (b.id === '@fesjs/preset-built-in') {
return 1;
}
if (/^(@fesjs\/|@webank\/fes-|fes-)build-/.test(a.id)) {
if (/^(@fesjs\/|@webank\/fes-|fes-)builder-/.test(a.id)) {
return -1;
}
if (/^(@fesjs\/|@webank\/fes-|fes-)build-/.test(b.id)) {
if (/^(@fesjs\/|@webank\/fes-|fes-)builder-/.test(b.id)) {
return 1;
}
return 0;

View File

@ -44,7 +44,7 @@
},
"dependencies": {
"@fesjs/fes": "^2.0.0",
"@fesjs/build-webpack": "^1.0.0",
"@fesjs/builder-webpack": "^1.0.0",
"vue": "^3.0.5",
"@fesjs/fes-design": "^0.1.10"
},

View File

@ -41,6 +41,6 @@ export default {
require.resolve('../../../fes-plugin-qiankun/lib'),
],
presets: [
require.resolve('../../../fes-build-vite/lib'),
require.resolve('../../../fes-builder-vite/lib'),
]
};

View File

@ -39,6 +39,6 @@ export default {
require.resolve('../../../fes-plugin-qiankun/lib'),
],
presets: [
require.resolve('../../../fes-build-webpack/lib'),
require.resolve('../../../fes-builder-webpack/lib'),
]
};

View File

@ -47,7 +47,7 @@
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-icon": "^2.0.0",
"@fesjs/plugin-request": "^2.0.0",
"@fesjs/build-webpack": "^1.0.0",
"@fesjs/builder-webpack": "^1.0.0",
"vue": "^3.2.2"
},
"private": true

View File

@ -58,7 +58,7 @@
"@fesjs/plugin-windicss": "^2.0.0",
"@fesjs/plugin-pinia": "^2.0.0",
"@fesjs/fes-design": "^0.3.3",
"@fesjs/build-vite": "^1.0.0",
"@fesjs/builder-vite": "^1.0.0",
"vue": "^3.0.5",
"vuex": "^4.0.0",
"pinia": "^2.0.11"

View File

@ -93,6 +93,6 @@ export default {
languages: ['javascript', 'typescript', 'html', 'json']
},
presets: [
require.resolve('../fes-build-webpack/lib'),
require.resolve('../fes-builder-webpack/lib'),
]
};